Changes to Global.asax.vb
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?
Re: Changes to Global.asax.vb
Any changes you make to any of the .vb files in the app will be ignored unless you Ctrl+Shift+B :)
Re: Changes to Global.asax.vb
Where abouts do I hit ctrl+shift+B? What does it do?
Re: Changes to Global.asax.vb
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.
Re: Changes to Global.asax.vb
So the .vb files are not necessary to be deployed on the web server? It just uses the compiled DLL?
Re: Changes to Global.asax.vb
Re: Changes to Global.asax.vb
And the ASPX pages of course, and the Global.ASAX fiels and your user controls and web.config... and stuff. :)
Re: Changes to Global.asax.vb
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?
Re: Changes to Global.asax.vb
Quote:
Originally Posted by simonm
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.
Re: Changes to Global.asax.vb
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?
Re: Changes to Global.asax.vb
In web.config
Code:
<appSettings>
<add key="ConnectionString" Value="Provider = your mom" />
</appSettings>
To access it in code,
VB Code:
Dim strConn As String
strConn = ConfigurationSettings.AppSettings("ConnectionString")
Re: Changes to Global.asax.vb
Ah, cheers man. You are a lifesaver! :afrog: :)
Re: Changes to Global.asax.vb
I know... just ask Seinfeld. :cool: