ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ASP.NET Application object?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#)
View previous topic :: View next topic  
Author Message
Tunes



Joined: 18 Oct 2004
Posts: 2

PostPosted: Mon Oct 18, 2004 7:46 pm    Post subject: ASP.NET Application object? Reply with quote

Im new to ASP.NET, but I have some experience with ASP.
In ASP I keep my SQL connection strings in Application object and I can use them everywhere in my application like this:

Application("strConnection")

Can I do the same in ASP.NET, or is there a better way to do that?
Back to top
View user's profile Send private message
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Mon Oct 18, 2004 9:49 pm    Post subject: Reply with quote

Hi,

With ASP.NET you can keep your configuration settings in your web.config file like this:

<configuration>
....
....
<appSettings>
<add key="strConnection" value="Your_Connection_String_Here" />
</appSettings>
....
....
</configuration>

You can add more key/value pairs by adding <add> elements in the web.config. To read the value in your code, do the following:

strConn = System.Configuration.ConfigurationSettings.AppSettings("strConnection")


Cheers,
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial