Hello sir, I am using this code to solve canonical issue but when i type http://vegascasino21.com/ it redirects to http://www.vegascasino21.com/index.aspx . but i don't want index.aspx with it.

Please suggest me something so that i get desired result.

void Application_BeginRequest(object sendr, EventArgs e)  
        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://vegascasino21.com/"))  
            HttpContext.Current.Response.Status = "301 Moved Permanently";  
            HttpContext.Current.Response.StatusCode = 301;  
             HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://vegascasino21.com/", "http://www.vegascasino21.com/"));  

Edited by __avd: Added [code] tags. Do wrap your programming code blocks within [code] ... [/code] tags

6 Years
Discussion Span
Last Post by Ramesh S


The index.aspx is set as the default document to your web site. You can change or remove it in IIS 6.0 using the following steps:

1. Open the IIS ( Start->inetmgr)
2. In the IIS, Expand Server Name->Web Sites->Right click on your site->Select Properties menu
3. In the Properties dialog box, Click on the Documents tab
4. In the List box Under the 'Enable default content page' checkbox, you can add new content page (.aspx page) or change the order of the existing default pages using Move Up and Move Down buttons. Based on this settings, your site will display the default page when the url is typed.

Also refer this link: Setting Up Default Documents (IIS 6.0)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.