c# - Related to url rewriting -
"i want perform 301 redirect in site. so,
it redirect www.example.com
there lots of ways this. easiest use iis url rewrite module
alternatively, place redirect in global.asax.cs
file in application_beginrequest
:
void application_beginrequest(object sender, eventargs e) { if (httpcontext.current.request.url.absoluteuri.equals("http://www.example.com/foo.aspx")) { string newurl = "http://www.example.com"; response.status = "301 moved permanently"; response.statuscode = 301; response.statusdescription = "moved permanently"; response.addheader("location", newurl); response.end(); } }
Comments
Post a Comment