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&param2=3

i want redirect such request "pagenotfound"

below not options:

  1. remove page: since aspx page used in application other purposes.
  2. not interested redirect on pagelod event (correct me if best way of doing it.)

interested know if possible way:

  1. handle though asp.net mvc area (which part of web forms app) routeconfiguration?
  2. isapi
  3. 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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -