How to configure my website that can be accessible using url like http://sitename.servername.com
Currently I am able to access my site using http://servername.com/Sitename/default.aspx , but I want to use . notation instead of /
I am using ASP.NET 4.0 with IIS 7.5 on Windows Server 2008 R2.
Thanks.
use the following code in 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");
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.