Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Question regarding detecting 404 Not Found

Reply
Thread Tools

Question regarding detecting 404 Not Found

 
 
Jeff
Guest
Posts: n/a
 
      03-02-2010
Hi

asp.net 3.5

I see in the statics for mys ite that about 50% of the request are 404 not
found. so I'm setting up a NoSuchPage.aspx which I want the user to be
redirected to when such error occur.

<customErrors mode="RemoteOnly" defaultRedirect="AppErrors.aspx">
<error statusCode="404" redirect="NoSuchPage.aspx"/>
<error statusCode="403" redirect="NoAccessAllowed.aspx"/>
</customErrors>

In the NoSuchPage I want to write to the database which page the user
requested.
I'm unsure about how to get info about that Page. I've tryed
Uri.AbsolutePath, but that only gave NoSuchPage.aspx... And
Request.UrlReferrer gives compile error
what you suggest?


 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      03-02-2010
Okay, I've solved it. I use
Request.RawUrl.ToString()



"Jeff" <> wrote in message
news:%...
> Hi
>
> asp.net 3.5
>
> I see in the statics for mys ite that about 50% of the request are 404 not
> found. so I'm setting up a NoSuchPage.aspx which I want the user to be
> redirected to when such error occur.
>
> <customErrors mode="RemoteOnly" defaultRedirect="AppErrors.aspx">
> <error statusCode="404" redirect="NoSuchPage.aspx"/>
> <error statusCode="403" redirect="NoAccessAllowed.aspx"/>
> </customErrors>
>
> In the NoSuchPage I want to write to the database which page the user
> requested.
> I'm unsure about how to get info about that Page. I've tryed
> Uri.AbsolutePath, but that only gave NoSuchPage.aspx... And
> Request.UrlReferrer gives compile error
> what you suggest?
>
>



 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      03-02-2010
On Mar 2, 12:55*pm, "Jeff" <it_consulta...@hotmail.com.NOSPAM> wrote:
> Hi
>
> asp.net 3.5
>
> I see in the statics for mys ite that about 50% of the request are 404 not
> found. so I'm setting up a NoSuchPage.aspx which I want the user to be
> redirected to when such error occur.
>
> <customErrors mode="RemoteOnly" defaultRedirect="AppErrors.aspx">
> * *<error statusCode="404" redirect="NoSuchPage.aspx"/>
> * *<error statusCode="403" redirect="NoAccessAllowed.aspx"/>
> </customErrors>
>
> In the NoSuchPage I want to write to the database which page the user
> requested.
> I'm unsure about how to get info about that Page. I've tryed
> Uri.AbsolutePath, but that only gave NoSuchPage.aspx... And
> Request.UrlReferrer gives compile error
> what you suggest?


HttpRequest.UrlReferrer Property gets information about the URL of the
client's previous request that linked to the current URL. You need to
check if it is not null (UrlReferrer != null) because client can strip
that header
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding error "Http error-404 object not found" ashluvcadbury@gmail.com ASP .Net 0 04-16-2007 04:44 AM
Intercept IIS 404 errors? Issue with Viewstate and 404 Jonathan Folland ASP .Net 2 03-17-2005 02:32 AM
Trapping the 404 (resource not found) error Craig Wilson ASP .Net 2 10-08-2004 08:45 PM
error 404 with servlet not found...newbie question marco@pivitsoft.com Java 4 08-05-2004 04:14 AM
IIS reports SmartNav.htm as a 404 File Not Found, Why So? anon ASP .Net 7 04-09-2004 12:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57