Hello I need to solved my site canonical issue regarding non www to with www so how to use 301 redirect in Asp.net ???? Please give me answer as soon as possible
If you're in .Net 4.0 it is as simple as http://msdn.microsoft.com/en-us/library/dd384856.aspx. Otherwise check out this answer http://stackoverflow.com/questions/5410197/asp-net-3-5-googlebot-301-redirect-cannot-redirect-after-http-headers-have-bee.
I would rather add site binding for both www and without. It is not a good idea to have a site with a non-both bindings (http://domain.com and http://www.domain.com) http://technet.microsoft.com/en-us/library/cc731692(WS.10).aspx Think of that
In internet services manager, right click on the file or folder you wish to redirect Select the radio titled "a redirection to a URL". Enter the redirection page Check "The exact url entered above" and the "A permanent redirection for this resource" Click on 'Apply' ColdFusion Redirect <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-url.com"> PHP Redirect <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?> ASP Redirect <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-url.com/" %> ASP .NET Redirect <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } </script> JSP (Java) Redirect <% response.setStatus(301); response.setHeader( "Location", "http://www.new-url.com/" ); response.setHeader( "Connection", "close" ); %>