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
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.