问题
I've recently been given a website written in classic asp to configure and set up - although it also appears to have pages written in asp.net.
The problem I'm having at the moment is that it doesn;t appear to be picking up settings from the global.asa file such as Application("ConnectionString")....
As when I try to write them out from somewhere in the code - nothing appears.
Any idea how to congure this website to use global.asa...or why it's not already using it?
There is web.config file and global.asax...shouldn't this just be for .net?
The code will not compile in visual studio.
回答1:
I've seen this problem when the application directory is not set up in IIS with an application name. You can change that from the IIS manager.
回答2:
long the lines of what Luke pointed out already:
Check that you are placing the global.asa file in the root of the web Site/Virtual Directory that your application is running from.
回答3:
All excellent advice so far. Otherwise, it's difficult to mix-and-match classic asp and .Net.
There's some good baseline info at http://www.w3schools.com/ASP/asp_globalasa.asp.
回答4:
What type of file are you trying to read the values from global.asa in? An ASP page or ASPNET page?
As Jim W said, the values in global.asa will not be available in aspx pages, and vice-versa.
Also, keep in mind the subroutines in global.asa will not fire until an ASP page is requested and global.aspx routines will not fire until an ASPNET page is requested.
来源:https://stackoverflow.com/questions/1427779/classic-asp-asp-net-website-global-asa-not-working