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 the basic difference between asp and asp.net?

978


What is the use of placeholder control?

966


What are the various session state management options provided by asp.net?

940


How can we add an event handler for a ASP.NET function executed on MouseOver for a certain button.

1088


Tell me the code snippet to show how we can return 404 errors from HttpError?

1224


Give an example of cookie abuse.

1027


Define page fragment caching?

872


How to make sure that contents of an updatepanel update only when a partial postback takes place (and not on a full postback)?

915


What is difference between view state and session state?

822


Explain client side state management system.

924


What do you mean by authentication?

1028


How many types of controls are there in asp.net?

975


Where do the cookie state and session state information be stored?

884


how to transfer the file from client to server using asp.net

1059


Can I recieve both html markup for page and code in the asp.net web page's source code portion in the web browser?

885