return url value

D

David Thielen

Hi;

I have a page (page X) where I want to have a "Return" button and that takes
it back to the previous page (page A) - the one (page A) that linked to this
page (page X).

Is there an easy way to get the url of page A when page X first loads?
 
J

Jeffrey Tan[MSFT]

Hi dave,

Thanks for your post!

Normally, this is controlled by client side javascript code. We can use
history.go(-1) statement to implement go back function. Like below:
<script>
function goback() {
history.go(-1);
}
</script>
<a href="javascript:goback()">Back</a>

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

Hi;

I have a situation like the login page where I may have to go to a second
page before I go back. Is there a way to get the url?
 
P

Phillip Williams

I usually manage this scenario programmatically in my applications where i
maintain a session variable, e.g. Session["ReturnToURL"], which can be set by
each page before redirecting the response to the next page. Then any page
can use that variable when the user hits return to go back to the previous
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


David Thielen said:
Hi;

I have a situation like the login page where I may have to go to a second
page before I go back. Is there a way to get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



"Jeffrey Tan[MSFT]" said:
Hi dave,

Thanks for your post!

Normally, this is controlled by client side javascript code. We can use
history.go(-1) statement to implement go back function. Like below:
<script>
function goback() {
history.go(-1);
}
</script>
<a href="javascript:goback()">Back</a>

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

Hi;

I've got it implemented where it looks for file.aspx?returnurl=orig.aspx and
that is working nicely. I just wondered if that was already a session
variable somewhere set by ASP.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



Phillip Williams said:
I usually manage this scenario programmatically in my applications where i
maintain a session variable, e.g. Session["ReturnToURL"], which can be set by
each page before redirecting the response to the next page. Then any page
can use that variable when the user hits return to go back to the previous
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


David Thielen said:
Hi;

I have a situation like the login page where I may have to go to a second
page before I go back. Is there a way to get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



"Jeffrey Tan[MSFT]" said:
Hi dave,

Thanks for your post!

Normally, this is controlled by client side javascript code. We can use
history.go(-1) statement to implement go back function. Like below:
<script>
function goback() {
history.go(-1);
}
</script>
<a href="javascript:goback()">Back</a>

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steve

This works for me:

Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Page.IsPostBack Then
' Save the referrer Url
ViewState("ReferrerUrl") = Request.UrlReferrer.ToString()
End If
End Sub

Protected Sub BackButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

Response.Redirect(ViewState("ReferrerUrl").ToString())

End Sub



David Thielen said:
Hi;

I've got it implemented where it looks for file.aspx?returnurl=orig.aspx
and
that is working nicely. I just wondered if that was already a session
variable somewhere set by ASP.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



Phillip Williams said:
I usually manage this scenario programmatically in my applications where
i
maintain a session variable, e.g. Session["ReturnToURL"], which can be
set by
each page before redirecting the response to the next page. Then any
page
can use that variable when the user hits return to go back to the
previous
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


David Thielen said:
Hi;

I have a situation like the login page where I may have to go to a
second
page before I go back. Is there a way to get the url?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



:

Hi dave,

Thanks for your post!

Normally, this is controlled by client side javascript code. We can
use
history.go(-1) statement to implement go back function. Like below:
<script>
function goback() {
history.go(-1);
}
</script>
<a href="javascript:goback()">Back</a>

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader
so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 

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

No members online now.

Forum statistics

Threads
474,135
Messages
2,570,783
Members
47,341
Latest member
hanifree

Latest Threads

Top