Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   aspx to return a 404 with a friendly page inc/Session? (http://www.velocityreviews.com/forums/t626052-aspx-to-return-a-404-with-a-friendly-page-inc-session.html)

Dunc 07-17-2008 10:41 AM

aspx to return a 404 with a friendly page inc/Session?
 
Has anyone got a way to get asp.net to return a result code of 404
with a friendly page of any substance?

I have been trying to do a Server.Transfer from the global.asax.cs
Application_Error function, but because there's no access to the
session at this point (Application_OnAuthenticateRequest hasn't fired)
and my master page checks session values based on the transferred
context (that has no session when transferred from the error handler),
I get an error.

If I use Response.Redirect or the <customerrors> tag, I get a response
code of 302.

I've set up IIS to point to the aspx file, but that only works if the
user hits a non-existant page without an aspx extension; any aspx file
gets handled by .net and we end up with either a response code of 302
or an error.

This is REALLY annoying, as every time a page name changes, I end up
with legacy search engine traffic I don't want. I've been trying to
do this for a long time now; there must be some solution out there?

Thanks in advance,

Duncan

Michael Nemtsev [MVP] 07-17-2008 11:29 AM

Re: aspx to return a 404 with a friendly page inc/Session?
 
Hello Dunc,

Have u tried to implement the httphandler for this, where your session will
be available via IReadOnlySessionState|IRequiresSessionState.

see discussion there http://forums.asp.net/p/1273530/2414745.aspx

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


D> Has anyone got a way to get asp.net to return a result code of 404
D> with a friendly page of any substance?
D>
D> I have been trying to do a Server.Transfer from the global.asax.cs
D> Application_Error function, but because there's no access to the
D> session at this point (Application_OnAuthenticateRequest hasn't
D> fired) and my master page checks session values based on the
D> transferred context (that has no session when transferred from the
D> error handler), I get an error.
D>
D> If I use Response.Redirect or the <customerrors> tag, I get a
D> response code of 302.
D>
D> I've set up IIS to point to the aspx file, but that only works if the
D> user hits a non-existant page without an aspx extension; any aspx
D> file gets handled by .net and we end up with either a response code
D> of 302 or an error.
D>
D> This is REALLY annoying, as every time a page name changes, I end up
D> with legacy search engine traffic I don't want. I've been trying to
D> do this for a long time now; there must be some solution out there?
D>
D> Thanks in advance,
D>
D> Duncan
D>



Dunc 07-18-2008 03:14 PM

Re: aspx to return a 404 with a friendly page inc/Session?
 
Thanks for the response; unfortunately the method they're chasing is
has almost identical problems to the one I've found. Because you're
adding a handler for context.Error, there's no
Application_OnAuthenticateRequest, which means no session, which means
it bombs when it does a Server.Transfer to a page that has a master
page with some very basic functionality.

Any other ideas?


On Jul 17, 12:29*pm, Michael Nemtsev [MVP] <nemt...@msn.com> wrote:
> Hello Dunc,
>
> Have u tried to implement the httphandler for this, where your session will
> be available via IReadOnlySessionState|IRequiresSessionState.
>
> see discussion therehttp://forums.asp.net/p/1273530/2414745.aspx
>
> ---
> WBR,
> Michael *Nemtsev [Microsoft MVP] :: blog:http://spaces.live.com/laflour
>
> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
> D> Has anyone got a way to get asp.net to return a result code of 404
> D> with a friendly page of any substance?
> D>
> D> I have been trying to do a Server.Transfer from the global.asax.cs
> D> Application_Error function, but because there's no access to the
> D> session at this point (Application_OnAuthenticateRequest hasn't
> D> fired) and my master page checks session values based on the
> D> transferred context (that has no session when transferred from the
> D> error handler), I get an error.
> D>
> D> If I use Response.Redirect or the <customerrors> tag, I get a
> D> response code of 302.
> D>
> D> I've set up IIS to point to the aspx file, but that only works if the
> D> user hits a non-existant page without an aspx extension; any aspx
> D> file gets handled by .net and we end up with either a response code
> D> of 302 or an error.
> D>
> D> This is REALLY annoying, as every time a page name changes, I end up
> D> with legacy search engine traffic I don't want. *I've been trying to
> D> do this for a long time now; there must be some solution out there?
> D>
> D> Thanks in advance,
> D>
> D> Duncan
> D>




All times are GMT. The time now is 05:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.