asp.net - Redirect from www to non-www with using subdomain -


i need redirect url www non-www when user enters url subdomain.

example:

www.abc.xyz.com abc.xyz.com

string url = request["http_request_url"];  // not sure exact constant name of header uri uri = new uri(url); if(uri.host.startswith("www.") && uri.host.count(c => (c == '.'))>2) {     response.redirect(url.replace("www.", "")); } 

thought said before, think redundant because browsers checks you...
, should avoid being "too smart own good".


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -