Redirecting default.aspx to root virtual directory

后端 未结 6 616
自闭症患者
自闭症患者 2020-12-15 08:34

I have a simple ASP.NET 3.5 application running under IIS7 under a virtual directory. So the URL of my app is like http://example.com/app. I want to 301-redirect the request

6条回答
  •  太阳男子
    2020-12-15 09:11

    This worked for me. http://www.w3schools.com/asp/met_redirect.asp

    Using the above link, I wrote the following lines and it executed without any problem. Notice there is no semicolon at the end. My default.aspx page just contains the following three lines.

    <%
        Response.Redirect("~/portal")
    %>
    

    Possible reason is; usually language is mentioned at the top of .aspx pages or in the web.config file. If language is not mentioned, IIS uses VB.NET to compile the pages and we know that VB.NET doesn't uses semicolons to terminate the statements.

提交回复
热议问题