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?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is base class of button control in .net?

1054


Describe how passport authentication works.

1179


What is the procedure to create the environment for asp.net? : asp.net mvc

1114


How are sessions stored?

1042


What are sessions used for?

1049


What is slidemaster?

999


How can you pass multiple complex types in Web API?

1123


What is a server farm in iis?

1084


Whta are the Various steps taken to optimize a web based application (caching, stored procedure etc.) ?

1118


Why we use dbms for projects? Why don’t we save any application data in separate files instead of dbms?

1063


Is asp.net easy to learn?

1044


What is the difference between ASP Session State and ASP.Net Session State?

1129


Explain the steps to be followed to use passport authentication.

1085


What is event bubbling?

1069


What are the layouts of ASP.NET Pages?

1096