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...


What is the Difference between Web.config and global.asax?
Can we write connection String code in global.asax?

Answers were Sorted based on User's Feedback



What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / abhishek vyas indore

web.config file is generated automatically if we are run a application in first time a but gloabal.asax file is not generated its a optional file,

web.config is a xml file where global.asax is class file
web.config file is more efficient as compared to global.asax

Is This Answer Correct ?    24 Yes 2 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / umesh

web.config file is the root page in the application we use
this file to make the connection with the database,we can
use theme attribute,authentication etc.

Where as global.asax file is for handling the Application
or page level error.

Is This Answer Correct ?    16 Yes 0 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / hridya

We can place connction str in global.asax

bt

web.config file is generally considered a better place
because it's a
simple text file that is easily updated without needing to
recompile
anything and changes go into effect immediately.

Is This Answer Correct ?    11 Yes 0 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / nidhi

Global.asax files allows you to executing ASP.Net application level events and setting application level variable.

The web.config file uses a predefined XML format. The entire content of the file is nested in a
root <configuration> element.

We can create more than one web.config file but we can't have more than one Global.asax file.

Yes we can write connection string in Global.asax file.

First store connection string in web.config file and fetch
in a Global.asax file using below code.

In global.asax

Application["VariableName"] = ConfigurationManager.ConnectionStrings["ConnStr"].
ConnectionString;

Now to fetch the value from applictaion variable

string conn = Application["VariableName"].ToString();

Is This Answer Correct ?    2 Yes 0 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / pragati

1. Web.config : It is an XML File
Global.asax file : It is an .asax file that is a class file

2. Web.config : We can have one or more web.config file.
Global.asax file : We can have only one global.asax files in one single application

3. Web.config : It consists of - a)Error Handling Codes b)Authentication c)Authorization
Global.asax file : It consists of - a)Application Events b)Session Events c)#include directive d)<object>declarations e)TypeLibrary Declarations

4. Web.config : It consists of ) HTTPHandlers
Global.asax file : It consists of declaration of objects,variables and methods.

5. Web.config : It is created by default thus,indicating its compulsion.
Global.asax file : It is an optional file.

6. Web.config : It is written in the form of HTML Tags.All configurations are mentioned in the <configuration> tag.
Global.asax file : All the code is written in valid browser scripts like JScript PerlScript, VBScript.

7. Web.config : It just needs to be saved and not be compiled to reflect the changes.
Global.asax file : It needs to compiled/rebuild to reflect the changes

8. Web.config : It consists of (a) HTTPHandlers
Global.asax file : It consists of events like :
(a)Application_OnStart
(b)Application_OnEnd
(c)Session_OnStart
(d)Session_OnEnd

Is This Answer Correct ?    2 Yes 0 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / asmita

web.config file if root level file you do not need to create it it is mainly used for authentication authorization ,database connection etc







global.asax file mainly handles application and session events.

Is This Answer Correct ?    1 Yes 0 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / dasharatham

sorry to the above answer which is applicable to ASP.NET
application folders..


web.config is which is used for settings to an application
in future requirement.

Global.asax which is handling application level events and
session level events..

I expected we can place the connection string like this
void Session_Start(object sender, EventArgs e)
{
Application["sqldb"] = ConfigurationManager.AppSettings
["constr"].ToString();
}

Is This Answer Correct ?    7 Yes 7 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / akshay

please give me answer the between Web.config and global.asax?

Is This Answer Correct ?    1 Yes 3 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / saiish

web.config contains values.
global.config contains code.


n we cant place connection string code in global.asax.
we can place only in web.config.

Is This Answer Correct ?    6 Yes 15 No

What is the Difference between Web.config and global.asax? Can we write connection String code in g..

Answer / dasharatham

App_code,App_themes,App_data,App_globalresources,App_localre
sources.

Is This Answer Correct ?    3 Yes 19 No

Post New Answer

More ASP.NET Interview Questions

What are Http handler ?

1 Answers   Patni,


What are the advantages and disadvantages of session?

0 Answers  


Where would you use an IHttpModule, and what are the limitations of anyapproach you might take in implementing one?

1 Answers   Siebel Systems,


Where we create sessions for Banking Applications and how to create? expalin with code?

1 Answers   Wipro,


What is an iHTTPModule, and explain its implementation with its limitations?

1 Answers   Siebel,


In which scenario we use Session and Cookies? With Example..

1 Answers  


Explain the difference between asp and asp.net?

0 Answers  


Can we change the session timeout in ASP.NET, if yes then how and from where?

7 Answers   L&T,


How can we communicate with each server in N-tier Architecture? and what are the methods?

0 Answers   Wipro,


What is asp.net localization?

0 Answers  


What is the importence of the INTERFACE? but not the inheritence concept?and why we r declaring the empty methods in that? we can directly implements with in the class know? Tell me the importence?

2 Answers  


Explain the advantages of passport authentication.

0 Answers  


Categories