• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

IIS7 Redirect Base URL to Subdirectory page?

Hello all,

I have a asp.net web application in IIS7 that I simply when the user hits the base URL path such as:

https://mysite.myhost.net/

I want it to go to:

https://mysite.myhost.net/sample/login/login.aspx

I have tried redirect and url rewrite in IIS7 but it is not working.
0
sbornstein2
Asked:
sbornstein2
  • 3
  • 3
1 Solution
 
nap0leonCommented:
Have you tried updating the default page to use a 301 redirect?


<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","https://mysite.myhost.net/sample/login/login.aspx");
}
</script>

Open in new window

0
 
nap0leonCommented:
If you have direct access to the machine running IIS, you can try these steps:
1    In internet services manager, right click on the file or folder you wish to redirect
2   Select the radio titled "a redirection to a URL".
3    Enter the redirection page
4    Check "The exact url entered above" and the "A permanent redirection for this resource"
5    Click on 'Apply'
0
 
sbornstein2Author Commented:
nap0leon I cant do it actually in the code as I don't have access to the code currently.  I can do something in the web config though or IIS directly.  I think something can be done in the web config with a rule etc. but need a example of using these sample URLs as you have it here in code.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
nap0leonCommented:
Bump to make sure you saw my comment that I posted at the same time.

Good luck.
0
 
sbornstein2Author Commented:
2   Select the radio titled "a redirection to a URL". (I don't see this if I right click the file in IIS7 I only see edit permissions etc under Content View)
0
 
ivan_vaguninCommented:
Hi! You can put custom redirection logic in global.asax of your application.
Follow this example:
http://www.spsamples.com/2011/07/aspnet-redirect-requests-for.html
0
 
sbornstein2Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now