webpage redirection help

talion83

Member
Mar 21, 2011
67
0
61
I am not normally a programmer or IIS admin - however the person who used to do this for my company recently left and has not been replaced yet. I have experience scripting primarily in classic VB (and powershell and many many years ago took a class on C#) but no experience with .NET.

We have multiple Web Applications being hosted on one Site. The way we have done this on classic ASP pages is by using the following code to forward people from the URL they type to the correct location:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Page = ucase(replace(Request.ServerVariables("SERVER_NAME"), ".domain.com", ""))
if Page = "page1" then
response.redirect "/Page1"
elseif Page = "Page2" then
response.redirect "Page2"

end if
%>
<html>
<head></head>
<body>
Test page
</body>
</html>

What happens is if someone types in Page1.Domain.com they are sent to the correct Virtual Directory in IIS (which is domain.com/Page1) - same for Page2.

Now I need to take that same idea and apply it to a Site that is using .NET 4 application pool instead of ASP. or if there is a better way to do this in IIS I am open to suggestions there as well.

Thank you all for any help that can be offered. If something didn't make sense please let me know and I will try to further explain.
 

Tweak155

Lifer
Sep 23, 2003
11,449
264
126
I think an @Http function will do what you're looking for, but I'm not familiar with C# yet, only a very few minor things.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Response.Redirect on the code page will work just fine. Server.transfer might work as well, but it won't change the url in the browser.