|
-
Feb 6th, 2003, 11:02 AM
#1
Thread Starter
Fanatic Member
ini-xml
Currently I am usiing an ini file with vb 6 to get the names of the server, database, username, password.
I wouold like to do the same thing in .net
What is the best way to do this? Should I use the ini file as it is now or is it best to call an xml file which has the same info as the ini file.
Thanks
-
Feb 6th, 2003, 04:01 PM
#2
Fanatic Member
Umm, you've posted in the ASP.NET forum, so i'm assuming you want to do this with an asp.net application... If so, i think you should take a look at the web.config file... you can add your own configuration settings that are accessible by all pages in that web...
for example:
VB Code:
?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
'Some other configuration information is here
</system.web>
<appSettings>
<add key="conString" value="Server=myserver.com;UID=MyUsername;PWD=MyPassword;Database=MyDatabase" />
<add key="WebPath" value="C:\InetPub\wwwroot\MyWeb\" />
</appSettings>
</configuration>
then you can retrieve these settings with the following code:
VB Code:
ConfigurationSettings.AppSettings("conString")
Quite simple i think... this might not be an extremely secure method to store things like database passwords, but it would be just as secure, if not more secure than an ini or xml file in the same directory...
I'm pretty sure that you can add and/or edit settings programmatically as well, however i've never had the need to do so, so i can't provide any code examples for that..
If you're looking for something similar for a VB.NET app, well, i think you can do something much the same except it would be with the MyExeName.config file.. but don't quote me on this, i haven't worked enough with vb.net to know for sure...
anyways, that should get you started
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|