1.can we add connection string in global.asax??????????
2.what are the default files included when we create new
web application????
Answers were Sorted based on User's Feedback
Answer / deepak
<%@ Import Namespace=”System.Data” %>
<%@ Import Namespace=”System.Data.Odbc” %> <script
language=”C#” runat=”server”>
void Application_Start()
{
//Connection string for SQL Server with trusted
connection
Application.Add (”DB_CONNECTION_STRING”,”DRIVER={SQL
Server};SERVER=ServerName;DATABASE=DataBaseName;Trusted_connection=yes;”);
}
void Session_Start()
{
//open connection to database
OdbcConnection cnConnection = new OdbcConnection
(Application.Get(”DB_CONNECTION_STRING”).ToString());
cnConnection.Open();
Session.Add (”DB_CONNECTION”, cnConnection );
}
void Session_End()
{
//a graceful disconnect
OdbcConnection cnConnection = (OdbcConnection)
Session["DB_CONNECTION"];
cnConnection.Close ();
}
</script>
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / ahmad dawood
Yes you Can add Connection string in Global.aspx in the
[Sub Application_Start] or in the [Sub Session_Start]
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / jerry joseph
Connection String can be stored as an Application Variable.
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / sandeep
it is possible only by using session but it is not
good practics
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / jom george
we can add connection string in global.asax
2. App_Data,Default.aspx,Webconfif are the default files when we create a new web applications.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / chaitali
no,we can't add the connection string in global.asax..
global.asax is a text file,It is use to define the global
variable.
| Is This Answer Correct ? | 1 Yes | 7 No |
Answer / himasankar
1)We can't add connection string in global.asax file. we can
create connection string in web.config file only.
2)global.asax,web.config,Default.aspx files and
app_code,app_data,app_themes folders.
| Is This Answer Correct ? | 4 Yes | 12 No |
What is difference between View State and Hidden Field in ASP.NET?
Explain the asp.net mvc request life cycle? : asp.net mvc
Can we throw exception from catch block ?
4 Answers Accenture, BirlaSoft,
Explain what is viewstate?
Which of the following hosts Can't be used to create .net Application? a) IIS b) Internet Explorer c) ASP.Net d) Windows Shell Which one is correct?
Explain what the contents of cookie?
SessionState - type of sessionstate and when and how to use it
The technical part was on ASP.Net only of web services.
How can we inherit a static member?
Which institute provide good Project training on .Net technologies in hyd?
which event in global.asx that fires for every request of same user?
What is web api and why to use it?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)