Redirecting to Full Domain

2019-02-15 12:07发布

问题:

I currently have a ASP .Net web application. I have some cross domain referencing in my application, so when users visit my page, I need to ensure they enter the full domain name.

So for example I need to redirect from

http://someserver/someapplication.page.aspx

to

http://someserver.domain.com/someapplication.page.aspx

I have the REGEx set up to catch the URL if it does not have the domain.com, also to hold anything after the 'someserver/', lets call this 'RegExMatch'. I just need to know what to call within to get the Full domain -

Response.Redirect({0}+RegexMatch);

Thanks in advanced.

回答1:

Found a way to do this in the IIS settings of the Application.

For anyone that is interested, here are the details. It is called Url Rewrite. http://www.iis.net/learn/extensions/url-rewrite-module/seo-rule-templates.