IFRAME

C

Conax

Hi,

I'm intending to use a IFRAME in one of my ASP page.

What I'd like to know is how to prevent user from directly accessing the
page that is the source of the IFRAME?

E.g.

Main page is main.asp

Inside main.asp..

<IFRAME src="data.asp">

If someone tried to enter ..mysite/data.asp in the browser's address bar, I
would like to redirect him back to main.asp

Thanks for your kind help.
Conax
 
U

UncleWobbly

use some Javascript in the target page to see where it was accessed from

or

set a session variable and check that in the target page

or

???

All of the above come with baggage but whichever way, I think the onus is on
the target page to check it has been accessed properly as it will be
difficult to conceal the target in the first page.
 
R

Roland Hall

:
: Hi,
:
: I'm intending to use a IFRAME in one of my ASP page.
:
: What I'd like to know is how to prevent user from directly accessing the
: page that is the source of the IFRAME?

<script type="text/javascript">
if (parent.location.href == self.location.href) {
parent.location.href="main.asp";
}
</script>

http://kiddanger.com/lab/iframechild.asp

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp
 
S

Steven Burn

iFramepage.asp

<% If Request.ServerVariables("HTTP_REFERER") =
"http://www.domain.com/mainpage.asp" Then %>
'mainpage.asp opened it, do something
<%
Else
Response.Redirect "mainpage.asp"
End If
%>

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top