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



1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

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

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

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

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

Answer / jerry joseph

Connection String can be stored as an Application Variable.

Is This Answer Correct ?    6 Yes 0 No

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

Answer / sandeep

it is possible only by using session but it is not
good practics

Is This Answer Correct ?    4 Yes 1 No

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

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

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

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

1.can we add connection string in global.asax?????????? 2.what are the default files included when ..

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

Post New Answer

More ASP.NET Interview Questions

What is repository pattern in mvc.net? : asp.net mvc

0 Answers  


33) You create English, French, and German versions of your ASP.NET application. You have separate resource files for each language version. You need to deploy the appropriate resource file based on the language settings of the server. What should you do? A . Create an installer and set the Installer.Context property for each version of your application. B . Create an installer that has a launch condition to verify the locale settings. C . Create an installer that has a custom action to install only location-specific files. D . Create an installer that has an MsiConfigureProduct function to install the appropriate version.

2 Answers   Friedkin, ISH, Syntax, Syntax Softtech,


Explain significance of routing? : asp.net mvc

0 Answers  


Is it possible to write code in many languages in one asp.net project?

0 Answers  


how many character send in one sms forget 160limit and think about gateway allowed

2 Answers   Wipro,


there is two functions function a and function b like fun a(){.... ..... } fun b() { } in function b i write the coding to add two numbers and i need to dispaly the sum result in function a with out using global variable. how we do?

1 Answers  


what is Repeater Control, When it is used,How it is used, what type of template is used for repeater control?

6 Answers   iSoft,


what is use of web.config?

3 Answers  


What is different authentication mechanisms used in ASP.NET?

0 Answers   Amdocs,


Explain some of the major built-in objects in asp.net

0 Answers  


step to create a strong name?

1 Answers  


To which class you load XML or Related Data

1 Answers  


Categories