哪里是在Visual Studio 2010中的global.asax.cs [英] Where is global.asax.cs in Visual Studio 2010
本文介绍了哪里是在Visual Studio 2010中的global.asax.cs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有一个全球应用类code-背后更多的在我安装的模板。我想说明的是Global.asax中。我觉得更舒适的的Global.asax.cs 工作。
- 为什么我看不到它了?
- 如何重新创建的Global.asax.cs?
解决方案
这是因为你创建了一个网站,而不是一个Web应用程序。我建议你使用的是precomipled的网络应用模式,但如果你需要使用一个网站,你可以做到以下几点:
〜/ Global.asax中
:
<%@应用codeFILE =的Global.asax.cs继承=AppName.MyApplicationLANGUAGE =C#%>
〜/的Global.asax.cs
:
命名空间AppName的
{
公共部分类MyApplication的:System.Web.HttpApplication
{
保护无效的Application_Start()
{
}
}
}
现在重新打开VS您的网站。
I don't have a Global Application class code-behind any more inside my installed templates. All I have is Global.asax. I find more comfortable working with Global.asax.cs.
- Why am I not seeing it anymore?
- How to re-create Global.asax.cs?
解决方案
That's because you created a Web Site instead of a Web Application. I would recommend you using a precomipled Web Application model but if you need to use a Web Site you could do the following:
~/Global.asax
:
<%@ Application CodeFile="Global.asax.cs" Inherits="AppName.MyApplication" Language="C#" %>
~/Global.asax.cs
:
namespace AppName
{
public partial class MyApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
}
}
}
Now reopen your site in VS.
这篇关于哪里是在Visual Studio 2010中的global.asax.cs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文