Subject: object required Request
Posted By: RoniR Post Date: 1/4/2007 6:33:33 AM
hi guys i am having this error generated from this code
<html>
<head>
<SCRIPT LANGUAGE="VBScript">

dim ReturnUrl
ReturnUrl=request.ServerVariables("HTTP_REFERER")
</SCRIPT>

</head>
<body>
<p align=center>
<b>"An error has occured! Sorry for the inconvenience ..." </b>
    <br><br>
    <a href="<%=ReturnUrl%>"> Return To Page </a>
</p>
</body>
</html>

Object required:Request
Now i know that i used the request object in a client-side script. The client does not have any notion of the ASP environment so
what i am truying to do cannot be done in this manner. All i want is to create an error page for my asp.net website..i mean when an error occurs it goes to this page error.html,shows the message An error has occured! Sorry for the inconvenience ..." and then offer the user a link to go back to were he was which can be handeled by request.servervariables("HTTP_REFERER").I got stuck on my method and cant find any other way.Ur Help is appreciated.10x

Reply By: vinod_yadav1919 Reply Date: 1/4/2007 8:05:59 AM
Hi RoniR!!
Two ways to do samething
**********test1.asp**********
<html>
<head>
</head>
<body>
<SCRIPT LANGUAGE="VBScript" runat="server">

dim ReturnUrl
ReturnUrl=request.ServerVariables("HTTP_REFERER")

response.write("<p align=center>")
response.write("<b>""An error has occured! Sorry for the inconvenience ..."" </b><br><br>")
response.write("<a href='"&ReturnUrl&"'> Return To Page </a>")
response.write("</p>")
</SCRIPT>
</body>
</html>
***************test2.asp*************
<html>
<head>
<%
  dim ReturnUrl

ReturnUrl=request.ServerVariables("HTTP_REFERER")
%>
</head>

<body>
<p align=center>
<b>"An error has occured! Sorry for the inconvenience ..." </b>
    <br><br>
    <a href="<%=ReturnUrl%>"> Return To Page </a>
</p>
</body>
</html>
***************
Note:-
In first method you only need to specify runat=server so that ur script will run on the server,since on the client side (when u use <SCRIPT LANGUAGE="VBScript">) ,there is no request object ,that browser can understand.

hope this will help you




Cheers :)

vinod
Reply By: RoniR Reply Date: 1/5/2007 1:53:12 AM
hey thanks for the reply..Your first method didnt work i still got the same error. The second one worked fine .I just cant seem to be able to fill the variable ReturnUrl with the value of Request.ServerVariables("HTTP_REFERER") in the <a href="<%=ReturnUrl%>"> Return To Page </a>
ur help is appreciated.10x

Reply By: vinod_yadav1919 Reply Date: 1/8/2007 5:53:10 AM
Hii RoniR!!

Request.ServerVariables("HTTP_REFERER")  is used with <a href> tag,and sometimes it gives null value to..

these links will help you
http://www.sitepoint.com/forums/showthread.php?t=310184
http://www.velocityreviews.com/forums/t106630-problems-with-httpreferer.html

Cheers :)

vinod

Go to topic 54525

Return to index page 71
Return to index page 70
Return to index page 69
Return to index page 68
Return to index page 67
Return to index page 66
Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62