Go back where I came from

P

Peter

When user Clicks on the Close button on the main form I would like to go back where the user came from. If my form is the first page since IE was opened I would like to go to the specific website. Is that possible?

Thanks

Peter
 
G

Guest

To determine if there is history exists ,Checkout Request.UrlReferrer

code would be like ,

if (Request.UrlReferrer == null )
//add javascript to the close button to navigate to "specific page"
else
//add javascript to the close button to do history.go(-1);
 
C

clintonG

What version of ASP.NET are you using?
The answer Sreejith tried to give is incorrect.


<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


When user Clicks on the Close button on the main form I would like to go back where the user came from. If my form is the first page since IE was opened I would like to go to the specific website. Is that possible?

Thanks

Peter
 
P

Peter

I am using .NET 1.1
What version of ASP.NET are you using?
The answer Sreejith tried to give is incorrect.


<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


When user Clicks on the Close button on the main form I would like to go back where the user came from. If my form is the first page since IE was opened I would like to go to the specific website. Is that possible?

Thanks

Peter
 
C

clintonG

I'm sorry, I see I failed to explain why I thought Sreejith was wrong.
Do you want to go back only one page or back to the homepage of the website?

<%= Clinton Gallagher

I am using .NET 1.1
What version of ASP.NET are you using?
The answer Sreejith tried to give is incorrect.


<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


When user Clicks on the Close button on the main form I would like to go back where the user came from. If my form is the first page since IE was opened I would like to go to the specific website. Is that possible?

Thanks

Peter
 
P

Peter

One page.
I'm sorry, I see I failed to explain why I thought Sreejith was wrong.
Do you want to go back only one page or back to the homepage of the website?

<%= Clinton Gallagher

I am using .NET 1.1
What version of ASP.NET are you using?
The answer Sreejith tried to give is incorrect.


<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


When user Clicks on the Close button on the main form I would like to go back where the user came from. If my form is the first page since IE was opened I would like to go to the specific website. Is that possible?

Thanks

Peter
 
S

Steven Cheng[MSFT]

Sorry for the interrupting.

Hi Peter,

I think the Request.UrlReferer or javascript window.history.go(-1) all
make sense. However, Request.UrlReferer will contains the original page's
location (it's a standard http header ..), however, this is not always set
by the cilent browser. And as for window.history.go(-1) , this script will
make the clientside browser go back one steps from the browser's history
list(just like when we hit the "back" button on browser...). The problem
of history.go(-1) is that when we have performed some post back on the
form, the postback version of the page will also be added into the history
list , so go(-1) one steps may not meet the requirements. So if there is
postback on the page, we may have to record this , (make a post back count
stored in viewstate...) and so that we can put the count in the history.go(
-count) as parameter...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Peter" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Go back where I came from
| Date: Sun, 13 Nov 2005 22:43:25 -0600
| Lines: 151
| MIME-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_000E_01C5E8A3.A8CEDE10"
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: cpe-69-23-74-9.new.res.rr.com 69.23.74.9
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fa
stwebnet.it!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-on
line.de!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:357828
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| One page.
message | I'm sorry, I see I failed to explain why I thought Sreejith was wrong.
| Do you want to go back only one page or back to the homepage of the
website?
| <%= Clinton Gallagher
| I am using .NET 1.1
message | What version of ASP.NET are you using?
| The answer Sreejith tried to give is incorrect.
| <%= Clinton Gallagher
| METROmilwaukee (sm) "A Regional Information Service"
| NET csgallagher AT metromilwaukee.com
| URL http://metromilwaukee.com/
| URL http://clintongallagher.metromilwaukee.com/
| When user Clicks on the Close button on the main form I would
like to go back where the user came from. If my form is the first page
since IE was opened I would like to go to the specific website. Is that
possible?
| Thanks
| Peter
|
 

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
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top