marcel

msg:4375079 | 6:19 am on Oct 16, 2011 (gmt 0) |
Request.ServerVariables("HTTP_REFERER") [w3schools.com...]
|
bouncybunny

msg:4375113 | 11:56 am on Oct 16, 2011 (gmt 0) |
Thanks for that.
|
bouncybunny

msg:4375285 | 1:59 am on Oct 17, 2011 (gmt 0) |
Hmmm. For some reason I am getting 'StartTag: invalid element name‘ errors for this;
<%Response.Write(Request.ServerVariables("URL"))%> It works OK, if I call the 404.asp page directly by typing it into the browser bar. But when used as an error page, it gives the above error. Any ideas anyone?
|
Ocean10000

msg:4375451 | 1:35 pm on Oct 17, 2011 (gmt 0) |
try this instead. <% = Request.ServerVariables("URL")%>
|
bouncybunny

msg:4378990 | 4:16 am on Oct 25, 2011 (gmt 0) |
Thanks for that suggestion. Same problem, unfortunately. How irritating. The page loads, but stops loading at the point where that line of ASP code starts.
|
bouncybunny

msg:4379026 | 5:37 am on Oct 25, 2011 (gmt 0) |
I don’t know if it means anything, but it also gives those errors if it finds any ‘loose’ </span> tags in the document.
|
Ocean10000

msg:4379398 | 11:34 pm on Oct 25, 2011 (gmt 0) |
What Web browser are you using by chance?
|
bouncybunny

msg:4379426 | 1:03 am on Oct 26, 2011 (gmt 0) |
Safari on a Mac. I didnt think to check it on another browser, but will do so later.
|
bouncybunny

msg:4382382 | 1:04 am on Nov 2, 2011 (gmt 0) |
OK, I’ve tried this on Firefox on a Mac - which gives its own error page and IE 8 on W7, which loads the page fine, but simply disregards any of the ASP.
|
Ocean10000

msg:4382545 | 1:36 pm on Nov 2, 2011 (gmt 0) |
I just had a thought. The actual error page, is the file extension aspx or asp or html? If it is html extension IIS will not run any server side scripts. Which I think may be the actual problem you are seeing. You would have to rename the 404 Page extension to aspx, and update the reference in IIS to point to this version. And retest it.
|
bouncybunny

msg:4383892 | 9:23 pm on Nov 5, 2011 (gmt 0) |
Thanks. The filename is .asp. But I'll try aspx and see if that helps.
|
bouncybunny

msg:4384311 | 5:06 am on Nov 7, 2011 (gmt 0) |
Hmmmm. No, unfortunately using .asp or .aspx doesn’t solve the problem. If I call the page directly e.g. www.example.com/404.aspx then the script ‘seems' to kind of work. e.g. Sorry, the page <%Response.Write(Request.ServerVariables("URL"))%> has not been found! will display as "Sorry, the page /404.aspx has not been found!". But if I go to a non-existent page, I get the above errors.
|
marcel

msg:4384362 | 11:37 am on Nov 7, 2011 (gmt 0) |
How have you set up the Error page is IIS. Is it as a file or a URL? (if it's set up as a file, it will not run ASP script)
|
bouncybunny

msg:4384643 | 12:26 am on Nov 8, 2011 (gmt 0) |
Aha. Thanks, I'll check that out later. I'm pretty sure I set it as a file.
|
bouncybunny

msg:4384703 | 5:27 am on Nov 8, 2011 (gmt 0) |
OK, that’s fantastic. It works! Thanks for all your help people. Just one final question. When I try to use <%Response.Write(Request.ServerVariables("URL"))%> or <% = Request.ServerVariables("URL")%> Instead of returning the url of the page the user was trying to find, it returns the name of the 404 page. E.G. | Sorry, the page /404.asp has not been found |
| instead of | Sorry, the page /missing.html has not been found |
| . Any ideas?
|
wingnut

msg:4389339 | 11:16 am on Nov 21, 2011 (gmt 0) |
The code will not execute if you using the default 404 page as it is a static page (.htm). Look at this article [support.microsoft.com...]
|
bouncybunny

msg:4399971 | 6:52 am on Dec 21, 2011 (gmt 0) |
Thanks. I am using a static page, with a .asp extension. What I found is that the code which displays the referring page URL works fine, but the code which displays the sought after page URL doesn’t. However, as the result of another issue, I’ve discovered that the biggest problem is that this method doesn’t send a 404 error from the server. It actually returns an ‘OK’ found message. So I’ve had to abandon this idea for the time being, and used a .HTML file without any asp code, which sends the correct error. Unless anyone has any suggestions. Thanks for all the help.
|
|