asp.net - Redirect .aspx webpage using MVC routing -
i have asp.ne web forms application, in have asp.net mvc area (with razor view engine)
i have aspx page @ location project/pages/email.aspx
somehow either crawl agents or users, able request http://wwww.mydomain.com/pages/email.aspx?param1=2¶m2=3
i want redirect such request "pagenotfound"
below not options:
- remove page: since aspx page used in application other purposes.
- not interested redirect on pagelod event (correct me if best way of doing it.)
interested know if possible way:
- handle though asp.net mvc area (which part of web forms app) routeconfiguration?
- isapi
- web.config / global.asax
note: has 301 permanent redirect.
you can in web.config following this: https://stackoverflow.com/a/10400010/412451
in case like
<configuration> <location path="email.aspx"> <system.webserver> <httpredirect enabled="true" destination="http://domain.com/pagenotfound.aspx" httpresponsestatus="permanent" /> </system.webserver> </location> </configuration>
alternatively might @ url rewrite module in iis.
Comments
Post a Comment