1.can we add connection string in global.asax??????????
2.what are the default files included when we create new
web application????
Answer Posted / 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 |
Post New Answer View All Answers
Explain the significance of routing? : asp.net mvc
What should you do is you want to remove an existing component but would like to make some funtionalities?
Give 2 examples for scenarios when routing is not applied?
What are the events in a page life cycle?
What does uri mean?
How do you use viewstate?
What are merge modules?
Can you explain the basic use of dataview?
Explain authorization levels in .net ?
What is http only cookie?
Explain cookies with example.
Define secured sockets layer.
Can we have 2 web config files?
What is a viewbag?
What is the use of placeholder control? Can we see it at runtime?