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


Please Help Members By Posting Answers For Below Questions

What is the best Macanism to clear the Cache in asp.net

816


What is the difference between the asp and asp.net?

582


Who generates session id?

573


Is sql backend or frontend?

644


What is a postback ispostback and autopostback in asp net?

563






Explain the asp.net mvc request life cycle? : asp.net mvc

576


What is the difference between a multi-layer and multi-tier applications?

669


Define authentication and authorization.

715


How ASP and ASP.NET page works? Explain about asp.net page life cycle?

680


Why is this service branded with windows livetm?

693


Difference between using directive vs using statement?

587


What is the difference between session and viewstate?

590


9. Why should we hire you over the others waiting to be interviewed?

2257


Explain what benefit does your code receive if you decorate it with attributes demanding specific security permissions?

616


What is content place holder?

613