如何配置网站,可以使用url如http://sitename.servername.com访问
本文关键字:http sitename 访问 com servername url 可以使 何配置 配置 网站 | 更新日期: 2023-09-27 18:16:11
如何配置我的网站,可以使用url如http://sitename.servername.com访问
目前我能够访问我的网站使用http://servername.com/Sitename/default.aspx,但我想使用。符号代替/
我正在使用ASP。. NET 4.0 with IIS 7.5, Windows Server 2008 R2
谢谢。
在Global.asax
中使用以下代码public class Global : System.Web.HttpApplication
{
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Url.AbsolutePath.EndsWith("/"))
{
Server.Transfer(Request.Url.AbsolutePath + "default.aspx");
}
}
}