473,480 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 <customerrorstag, 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
Jul 17 '08 #1
2 1701
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
DHas anyone got a way to get asp.net to return a result code of 404
Dwith a friendly page of any substance?
D>
DI have been trying to do a Server.Transfer from the global.asax.cs
DApplication_Error function, but because there's no access to the
Dsession at this point (Application_OnAuthenticateRequest hasn't
Dfired) and my master page checks session values based on the
Dtransferred context (that has no session when transferred from the
Derror handler), I get an error.
D>
DIf I use Response.Redirect or the <customerrorstag, I get a
Dresponse code of 302.
D>
DI've set up IIS to point to the aspx file, but that only works if the
Duser hits a non-existant page without an aspx extension; any aspx
Dfile gets handled by .net and we end up with either a response code
Dof 302 or an error.
D>
DThis is REALLY annoying, as every time a page name changes, I end up
Dwith legacy search engine traffic I don't want. I've been trying to
Ddo this for a long time now; there must be some solution out there?
D>
DThanks in advance,
D>
DDuncan
D>
Jul 17 '08 #2
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.comwrote:
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

DHas anyone got a way to get asp.net to return a result code of 404
Dwith a friendly page of any substance?
D>
DI have been trying to do a Server.Transfer from the global.asax.cs
DApplication_Error function, but because there's no access to the
Dsession at this point (Application_OnAuthenticateRequest hasn't
Dfired) and my master page checks session values based on the
Dtransferred context (that has no session when transferred from the
Derror handler), I get an error.
D>
DIf I use Response.Redirect or the <customerrorstag, I get a
Dresponse code of 302.
D>
DI've set up IIS to point to the aspx file, but that only works if the
Duser hits a non-existant page without an aspx extension; any aspx
Dfile gets handled by .net and we end up with either a response code
Dof 302 or an error.
D>
DThis is REALLY annoying, as every time a page name changes, I end up
Dwith legacy search engine traffic I don't want. *I've been trying to
Ddo this for a long time now; there must be some solution out there?
D>
DThanks in advance,
D>
DDuncan
D>
Jul 18 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1417
by: ST | last post by:
Hi, I'm implementing a printer friendly feature for all the pages on a web site. I'm separating the header, content, and footer into separate ascx files, which are contained in the main file. ...
1
2418
by: Holly | last post by:
Hi, I have a page (A) that allows users to enter addresses and displays direction information and map images. The page A calls Microsoft's mappoint web service, gets the route info and map image....
4
1928
by: Matt Mercer | last post by:
Hi, I have a asp .net/VB web app that does the typical submitting and retrieving from a SQL database. I am lost as to how I should create a print friendly page for the data. Here is the...
11
1267
by: grizduck | last post by:
Hi- I have created a .NET web application that uses 6 aspx pages. As the users goes from one page to the next several variables are set and displayed on future pages. I found out today that if...
3
2000
by: kermit | last post by:
Hi, I am hoping this is a foolish or simple question. I am creating a multiuser app. consisit of a login page and a dataentry page. If the user leaves the data entry page (other than exiting the...
2
12343
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
6
5474
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
2
1991
by: WJ | last post by:
I have three ASPX pages: 1. "WebForm1.aspx" is interactive, responsible for calling a web site (https://www.payMe.com) with $$$. It is working fine. 2. "WebForm2.aspx" is non-interactive, a...
13
3511
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3011
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.