Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Best Practice for using a string across the app??

Reply
Thread Tools

Best Practice for using a string across the app??

 
 
David Lozzi
Guest
Posts: n/a
 
      12-06-2004
I need to have a string available per page, i.e. the SQL Connection String. What's the best way of doing this? Right now I have it loaded into a session variable, but I think I should do something with global.asax??

Thanks!

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      12-06-2004
the best thing to do is to put it in your web.config. It can then be accessed via ConfigurationSettings.AppSettings("connectionStrin g"). Even better would be to build a wrapper utility for this:

Public NotInheritable Class DatabaseUtility
Private Sub New()
End Sub

Public Shared ReadOnly Property ConnectionString() As String
Get
Return ConfigurationSettings.AppSettings("connectionStrin g")
End Get
End Property

End Class



it can then be accessed via DatabaseUtility.ConnectionString

Session is a bad place for it..since htere'a session by user, but this is a global thing.

--
MY ASP.Net tutorials
http://www.openmymind.net/


"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:OUMuUL%(E-Mail Removed)...
I need to have a string available per page, i.e. the SQL Connection String. What's the best way of doing this? Right now I have it loaded into a session variable, but I think I should do something with global.asax??

Thanks!

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best practice to create a JSON string of one object containing anarray of other objects using Ruby? Matthias S. Ruby 5 02-09-2011 09:46 PM
hidden data - best practice, best way, suggestions oldyork90 Javascript 1 09-10-2008 07:46 PM
Remember when your piano teacher taught you, "Practice, practice,practice ...?" Wayne Wastier Windows 64bit 3 06-10-2005 08:29 PM
Best Practice: Label/String storage for language conversion James Tillery ASP .Net 2 10-25-2004 10:23 PM
Best Practice: How to share an ASP.NET webform across multiple web apps: Jheitmuller ASP .Net 1 08-02-2004 10:56 PM



Advertisments