301 redirect

Posted on 2012-08-11
Last Modified: 2012-08-13
I would like to setup a 301 redirect so that my home page index.aspx always defaults to the domain URL.  So for example, I would like for to redirect automatically to

Can someone please help me with this?
Question by:anm1001
    LVL 33

    Expert Comment


    Author Comment

    When I tried this, it seems to go into an endless loop without displaying the page.  Is there another way?
    LVL 33

    Expert Comment

    In your index.aspx, try this.

    <%@ Page Language="C#" %>
    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    	Response.Status = "301 Moved Permanently";

    Open in new window

    LVL 18

    Accepted Solution

    in codebehind its may be never ending loop . Where as using javascript u may achieve . For eg.
    In javascript . Get url using document.url and check it consists of index.aspx if it has navigate with some special query string and then check in code behind if that special  query string is not null then do that with 301 redirect . Sorry , Am not having visual studio ide right now using mobile version.  Hope you get into a right direction with this .

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now