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/"));  
         }  
 }

Hi,

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.