Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 in a session cookie?

938


How can we inherit a static member?

1023


What are the steps to follow to host a web application on a web server?

1020


What is the exact purpose of http handlers?

976


Explain the steps needed to be performed in order to create an animation in xaml?

972


If we remove web.config or machine.config from the application then, is this application will works?

969


What is difference between web config and global asax?

830


Out of ASP or ASP.NET which one is stateless?

1167


Define repository pattern in mvc.net? : asp.net mvc

1006


What is the purpose of master page?

867


What are server side controls?

953


What websites use asp.net?

992


Explain the Order of events in an asp.net page?

977


Where do we store our connection string in asp.net application?

976


How we can force all the validation controls to run?

938