Click to See Complete Forum and Search --> : Changes to Global.asax.vb
simonm
Apr 21st, 2005, 04:05 AM
I have developed a VB.NET/ASP.NET application and am using the Global.asax.vb file to store some constants which are written to Application variables in the Application_Start event.
In development mode, I can make changes to the values of the constants, and when I build and run the application, these changes take effect as expected.
However, when I access my ASP application by simply navigating to my LocalHost (outside of the Visual Studio environment), any changes I make to the Global.asax.vb file are ignored.
Why is this?
mendhak
Apr 21st, 2005, 04:38 AM
Any changes you make to any of the .vb files in the app will be ignored unless you Ctrl+Shift+B :)
simonm
Apr 21st, 2005, 04:49 AM
Where abouts do I hit ctrl+shift+B? What does it do?
mendhak
Apr 21st, 2005, 04:52 AM
I meant "Build Solution." Every time you change something in the .vb files, build the solution again so that it gets compiled into your DLL. Ctrl+Shift+B is a keyboard shortcut many of us use to build the solution.
simonm
Apr 21st, 2005, 04:54 AM
So the .vb files are not necessary to be deployed on the web server? It just uses the compiled DLL?
mendhak
Apr 21st, 2005, 05:11 AM
Correct.
mendhak
Apr 21st, 2005, 05:12 AM
And the ASPX pages of course, and the Global.ASAX fiels and your user controls and web.config... and stuff. :)
simonm
Apr 21st, 2005, 05:38 AM
Do I not need to deploy anything but the compiled dlls then?
What I really want to do is allow the administrator at each web server that hosts my web project to be able to edit the database connection details...so that I can obtain these details when my application starts and build by database connection string accordingly.
What would be the best way to do this?
mendhak
Apr 21st, 2005, 05:47 AM
What I really want to do is allow the administrator at each web server that hosts my web project to be able to edit the database connection details...so that I can obtain these details when my application starts and build by database connection string accordingly.
What would be the best way to do this?
Put your connection string in your web.config file. Since it's text based, your admin can open that file in notepad, edit that line and save it.
simonm
Apr 21st, 2005, 06:05 AM
Funnilly enough, I tried putting something in my web.config file but wherever I tried to put the text, I got errors.
Could you possibly explain how I can add these details to my web.config file and then also how I would access these details in VB?
mendhak
Apr 21st, 2005, 06:07 AM
In web.config
<appSettings>
<add key="ConnectionString" Value="Provider = your mom" />
</appSettings>
To access it in code,
Dim strConn As String
strConn = ConfigurationSettings.AppSettings("ConnectionString")
simonm
Apr 21st, 2005, 06:13 AM
Ah, cheers man. You are a lifesaver! :afrog: :)
mendhak
Apr 21st, 2005, 06:18 AM
I know... just ask Seinfeld. :cool:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.