Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Previous page title

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tucson - 11 Mar 2008 00:40 GMT
Is there a way to get the page title of the previous page from an HREF link
without using Javascript (something server-side)?

<a
href="javascript:location.href=test.aspx?t='+escape(encodeURIComponent(document.title))">Go to next page</a>

This passes the document title but when I try to get
Request.ServerVariables("HTTP_REFERER"), I get nothing. Window.Open gives me
the same result.
I don't want to pass the referer through a querystring.

Thanks
Scott M. - 11 Mar 2008 01:06 GMT
You could set up the document title as a page property and then access it
using the new PreviousPage property.

http://msdn2.microsoft.com/en-us/library/ms178139.aspx

-Scott

> Is there a way to get the page title of the previous page from an HREF
> link
[quoted text clipped - 11 lines]
>
> Thanks
tucson - 11 Mar 2008 16:58 GMT
The previous page comes from a 3rd party page (on a different server,
different app. from mine). I have no control over that page whatsoever. They
created a link and all I can do is enter text between the brackets <a
href="[my text here only]">[my text]</a>.

> You could set up the document title as a page property and then access it
> using the new PreviousPage property.
[quoted text clipped - 18 lines]
> >
> > Thanks
Scott M. - 11 Mar 2008 22:52 GMT
If the previous page is not part of your application and if they are not
passing data to you (via a post or querystring), then there is no way to get
information about what was in that page.  This is the nature of HTTP.

-Scott

> The previous page comes from a 3rd party page (on a different server,
> different app. from mine). I have no control over that page whatsoever.
[quoted text clipped - 25 lines]
>> >
>> > Thanks
tucson - 11 Mar 2008 23:08 GMT
I have control over the querystring, that's the javascript I used below to
pass the document title.
<a
href="javascript:location.href=test.aspx?t='+escape(encodeURIComponent(document.title))">Go to next page</a>

The problem is I need both the document title and the http_referer but I
don't want to pass both through a querystring. I want one of them to be
server-side, if it exists. Using the javascript above,
Request.ServerVariables returns nothing.
If I just use <a href="test.aspx">Go to next page</a>, I can get the HTTP
REFERER but can't get the document.title.

I'm trying to avoid somebody just pasting the URL and getting to the page.

I did a workaround by redirecting them. So, they pass the document.title and
document.url through a querystring (encoded). The landing page captures the
info into a session and then redirects it to another page without the
querystring displayed.

But if somebody looks at the intermediate page URL and pastes some
document.title and document.url that match the requirement, it will still
redirect them to the final page.

It sounds like it's not possible to have both.
Thanks

> If the previous page is not part of your application and if they are not
> passing data to you (via a post or querystring), then there is no way to get
[quoted text clipped - 31 lines]
> >> >
> >> > Thanks
Paulus E Kurniawan - 11 Mar 2008 02:28 GMT
To make a cross-page request, you can use a Button or LinkButton server
control and set its PostBackUrl property to the target URL. You can also use
Server.Transfer method. On the target page, you can retrieve the title of the
previous page using:

Page.PreviousPage.Title

Hope this helps.
Signature

Paulus E Kurniawan
http://www.paulusevan.net

> Is there a way to get the page title of the previous page from an HREF link
> without using Javascript (something server-side)?
[quoted text clipped - 8 lines]
>
> Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.