B
Ben
Hi,
i use a page (first.aspx) containing javascript window.open for opening the
next asxp page (second.aspx).
<script type="text/javascript">
window.open("second.aspx", "", "")
</script>
I want to check in 'second.aspx' whether the previous page was 'first.aspx'
So i did this in second.aspx: (vb.net)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
if Request.urlReferrer.AbsolutePath = "first.aspx" then
accept access
else
deny access
end if
This doesn't work.
I tested with response.write(Request.urlReferrer.AbsolutePath) which gives
nothing.
Do i do something wrong?
Thanks for help
Dan
In the first page, i removed the session variables and so did i in the
second page, after the values are put into local variables, in order to
prevent the session variables still being active.
Now, when i start the application, the two pages are opened, but then, when
i copy/paste the address (without any parameters) from the address bar of
the second page into the first, i get 'myfile.aspx' into a page without any
restriction, what i don't want. I expected rather an error in the second
page telling me that there are no parameter ... I don't understand because
the session variables were removed.
Is there a way to fix that, i mean, to impede 'myfile.aspx' to be run
properly a second time into the first page?
Thanks
Dan
Here the code:
page 1:
------
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
Sub page_load()
Session("dir") = "myparam"
ClientScript.RegisterStartupScript(Me.GetType(), "page2",
"myfunc();", True)
End Sub
</script>
<html>
<head><title>page1</title>
</head>
<body>
page2:
-----
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
dim nrp as string
nrp = Session("dir")
Session.Clear()
.....
end sub
i use a page (first.aspx) containing javascript window.open for opening the
next asxp page (second.aspx).
<script type="text/javascript">
window.open("second.aspx", "", "")
</script>
I want to check in 'second.aspx' whether the previous page was 'first.aspx'
So i did this in second.aspx: (vb.net)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
if Request.urlReferrer.AbsolutePath = "first.aspx" then
accept access
else
deny access
end if
This doesn't work.
I tested with response.write(Request.urlReferrer.AbsolutePath) which gives
nothing.
Do i do something wrong?
Thanks for help
Dan
In the first page, i removed the session variables and so did i in the
second page, after the values are put into local variables, in order to
prevent the session variables still being active.
Now, when i start the application, the two pages are opened, but then, when
i copy/paste the address (without any parameters) from the address bar of
the second page into the first, i get 'myfile.aspx' into a page without any
restriction, what i don't want. I expected rather an error in the second
page telling me that there are no parameter ... I don't understand because
the session variables were removed.
Is there a way to fix that, i mean, to impede 'myfile.aspx' to be run
properly a second time into the first page?
Thanks
Dan
Here the code:
page 1:
------
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
Sub page_load()
Session("dir") = "myparam"
ClientScript.RegisterStartupScript(Me.GetType(), "page2",
"myfunc();", True)
End Sub
</script>
<html>
<head><title>page1</title>
</head>
<body>
page2:
-----
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
dim nrp as string
nrp = Session("dir")
Session.Clear()
.....
end sub