经典的 asp/asp.net 网站 - global.asa 不工作
最近我得到了一个用经典 ASP 编写的网站来配置和设置 - 尽管它似乎也有用 ASP.NET 编写的页面。
我目前遇到的问题是,它似乎没有从 global.asa 文件中获取设置,例如 Application("ConnectionString")....
当我尝试从某个位置写出它们时代码-什么也没有出现。
知道如何配置此网站以使用 global.asa...或者为什么它还没有使用它?
有 web.config 文件和 global.asax...这不应该只适用于 .net 吗?
该代码无法在 Visual Studio 中编译。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当未在 IIS 中使用应用程序名称设置应用程序目录时,我遇到过此问题。您可以从 IIS 管理器更改它。
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.
Luke 已经指出的内容很长:
检查您是否将 global.asa 文件放置在运行应用程序的网站/虚拟目录的根目录中。
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.
到目前为止所有的建议都很好。否则,很难混合搭配经典的 asp 和 .Net。
http://www.w3schools.com/ASP/asp_globalasa.asp< 有一些很好的基线信息/a>.
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.
您尝试从哪种类型的文件中读取 global.asa 的值? ASP 页面还是 ASPNET 页面?
正如 Jim W 所说,global.asa 中的值在 aspx 页面中不可用,反之亦然。
另外,请记住,在请求 ASP 页面之前,global.asa 中的子例程不会触发,在请求 ASPNET 页面之前,global.aspx 例程不会触发。
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.