• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 810
  • Last Modified:

if request null redirect http referrer

Hello, is this coded correctly /will it work --

(asp vb script)

thanks -

<% If Request("femail") NULL then Response.Redirect(Request.ServerVariables("HTTP_REFERER")) %>
0
garethtnash
Asked:
garethtnash
  • 3
4 Solutions
 
sammySeltzerCommented:
Should be something like:

<% If Request("femail") ="" then Response.Redirect(Request.ServerVariables("HTTP_REFERER")) %> 

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
assuming they have been set
referrer is not set when you load a url from the location bar or from bookmark
0
 
sammySeltzerCommented:
good point
0
 
neeraj523Commented:
Better to use it in this way


<%
If Request("femail") = "" Then
   If Request.ServerVariables("HTTP_REFERER") <> "" Then
     Response.Redirect(Request.ServerVariables("HTTP_REFERER"))
   Else
     Response.Write "Invalid access."
  End if
End if
%>
0
 
sammySeltzerCommented:
He could also user Server.Transfer.

It is actually safer.

One of my least favorites, an option nonetheless, is to use

<a href="javascript:history.go(-1)">GO BACK</a>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now