Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting Site Access

Status
Not open for further replies.

MSW

IS-IT--Management
Jan 9, 2002
48
US
I've created a website in FP2002 on my IIS server and I only want to allow users to get to it via a link from another Web Server at another site... To be more specific I don't want users just typing in the ip address and default.htm of the new website to go directly to this site.. I want to control the traffic for various reason thru the link at the other website if possible..

Thanks for your help
 
Throw a bit of ASP at the top of each page. Check for the HTTP REFERER var. If it equals that of your other server then let them on in, otherwise, redirect them to the other server.

Stick code such as this at the very top of your pages. This will only work of your page names end in .asp.
<code>
<%
If Request.ServerVariable(&quot;HTTP REFERER&quot;) <> &quot;the url of the other server&quot; Then
Response.Redirect(&quot;URL of otherpage&quot;)
End IF
%>
</code>
 
I cut and pasted the code into my default.asp page and edited the url of the &quot;other server&quot; with and edited the Response.Redirect with (&quot;
And I get this error:
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'ServerVariable'

/pbasp/Default.ASP, line 5

Thanks
 
Sorry to drag this out but I'm new to IIS and Web development in general if you didn't figure that out already..

Okay; I fixed the variable name issue and placed the code at the very top of my default.asp page and I get this message now.. Any Idea as to what I'm doing wrong here??
I placed the code before the <html> line on my page...

Response object error 'ASP 0156 : 80004005'

Header Error

/pbasp/Default.ASP, line 5

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

Thanks again
 
you cannot redirect after writing to the browser.

work around but sometimes not perfect fizes
add to the script

<%response.buffer=true%>



_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Okay I think I'm getting close but I'm still having a problem with the if statment. Below is the top part of my ASP page which contains the if statment in question.

<%Response.Buffer=true%>

<html><head>
<title>default.asp</title>
</head>
<%
If Request.ServerVariables(&quot;HTTP REFERER&quot;)<> &quot; Then
Response.Redirect(&quot;End IF
%>

The problem is that no matter where I connect to this page from it sends me to the address in the response.redirect command even if I'm connecting from which should allow the page to display.

I checked what was getting stored into the http_referer variable with an ASP page that displays back all of the variables and when I connect from the site that should allow the page to display the variable http_referer = Is the what I should be looking for in the above command or what??

Thank for your help..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top