c# - Handling 404's better in .NET -


As some of you are running a very large site, I want to take your opinion about the settlement of 404 Was there. I have taken charge of various setups with the net, but in reality it can never get to work right. I always come back to some kind of redirect or false headers, never 404. This is a real pain because the search engine does not get the correct response and even after hitting these pages, they are no longer existing. In return, this means that I can get errors reported for pages that I no longer exist. My current setup is as follows: IIS7, ASP.Net 3.5 for forwarding on my HTML error page, 404 Web to use the new redirect mod = "Response retreat" property. There are custom error page sections of Config Setup. IIS is configured to handle 404 and has been forwarded to the same HTML page. Elmah has been configured to report any such issues through email.

Now when I try the following addresses (a page that does not exist), NAT handles error and shows 200 responses. Obviously this should be a 404. When I try to get the right 404 but error was managed by IIS. Is it possible. This error is also to handle, so can Elma raise the error?

It would be great if I could get insight into the arrangements used by others to handle this kind of scenario correctly.

Thank you

Instead of using a static HTML page, you use the dynamic page Set the correct position code that can:

404.aspx:

  & lt;% @ page language = "c #"%> & Lt; Script runat = "server" & gt; Secure Zero Page_load (Object Sender, EventEurge E) {Response.StatusCode = 404; } & Lt; / Script & gt; & Lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head runat = "server" & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; Did not get & lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt;  

web.config:

  & lt; CustomErrors mode = "remote only" defaultRedirect = "GenericErrorPage.htm" redirectMode = "ResponseRewrite" & gt; & Lt; Error status code = "404" redirect = "404.aspx" /> & Lt; / CustomErrors & gt;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -