Changing domain name in HTTPModule

N

nsyforce

Can you change the domain name in an HTTPModule? I have seen examples
of changing the relative url in an HTTP Module, such as the following:
protected void AuthenticateRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication) sender;
HttpContext objContext = (HttpContext) app.Context;
objContext.RewritePath("mynewpage.aspx");
}

However, I'd like to take a request from
http://www.msdn.com/mypage.aspx and change it to
http://www.msdn.help.com:83/mypage.aspx. Is there a way I can do
this? I saw a comment on the web that you couldn't, but judging by the
nature of an HTTPModule, I'm not convinced that you can't do it. I've
tried changing the Host server variable, but got an error that this was
read only. I was debating about doing this in an ISAPI filter, but
would prefer using an HTTPModule if at all possible.

Thanks in advance
 
C

Curt_C [MVP]

Can you change the domain name in an HTTPModule? I have seen examples
of changing the relative url in an HTTP Module, such as the following:
protected void AuthenticateRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication) sender;
HttpContext objContext = (HttpContext) app.Context;
objContext.RewritePath("mynewpage.aspx");
}

However, I'd like to take a request from
http://www.msdn.com/mypage.aspx and change it to
http://www.msdn.help.com:83/mypage.aspx. Is there a way I can do
this? I saw a comment on the web that you couldn't, but judging by the
nature of an HTTPModule, I'm not convinced that you can't do it. I've
tried changing the Host server variable, but got an error that this was
read only. I was debating about doing this in an ISAPI filter, but
would prefer using an HTTPModule if at all possible.

Thanks in advance

Redirect to the new URL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top