I have a WebForms application ( .Net Framework 4.5.2) . I need to redirect some pages to external web page example www.google.com
I tried to modify the routes
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
private void RegisterRoutes(RouteCollection routes)
{
}
}
I need to know
Thanks,
I would probably use IIS Url Rewrite for that. It enables you to add rewrites/redirects in web.config like:
<rule name="Rule1">
<match url="somefunpage"/>
<conditions>
<add input="{HTTP_HOST}" pattern="mydomain.com"/>
</conditions>
<action type="Rewrite" url="http://www.otherdomain.com/" />
</rule>
You can also use regexp, wildcards etc. It's pretty powerful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.