473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how can I get tthe referring page?

Dear ASP.NET Programmers,

I want to store the referring page of an .aspx page so that I can redirect
the user back to the referring page if needed. I am using the following code
snippet but receiving Object reference not set to an instance of an object
error. The code is as follows:

If Not Page.IsPostBack Then
Viewstate("ReferrerURL") = Request.UrlReferrer.ToString()
LoadData()
End If

Why am I receiving this error? Thanks in advance...

Buran
Nov 18 '05 #1
2 2317
Hi, Buran,

You should not rely on this parameter as it might be incorrect in a variety
of cases.

You can send the referer in the query string from the refering page. You
will not need to store it in the ViewState as it will be preserved between
the postbacks anyway.

Greetings
Martin
"buran" <bu***@buran.com> wrote in message
news:#M**************@TK2MSFTNGP12.phx.gbl...
Dear ASP.NET Programmers,

I want to store the referring page of an .aspx page so that I can redirect
the user back to the referring page if needed. I am using the following code snippet but receiving Object reference not set to an instance of an object
error. The code is as follows:

If Not Page.IsPostBack Then
Viewstate("ReferrerURL") = Request.UrlReferrer.ToString()
LoadData()
End If

Why am I receiving this error? Thanks in advance...

Buran

Nov 18 '05 #2
Thank you Martin! :)

Buran

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:#V**************@TK2MSFTNGP09.phx.gbl...
Hi, Buran,

You should not rely on this parameter as it might be incorrect in a variety of cases.

You can send the referer in the query string from the refering page. You
will not need to store it in the ViewState as it will be preserved between
the postbacks anyway.

Greetings
Martin
"buran" <bu***@buran.com> wrote in message
news:#M**************@TK2MSFTNGP12.phx.gbl...
Dear ASP.NET Programmers,

I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following

code
snippet but receiving Object reference not set to an instance of an object error. The code is as follows:

If Not Page.IsPostBack Then
Viewstate("ReferrerURL") = Request.UrlReferrer.ToString()
LoadData()
End If

Why am I receiving this error? Thanks in advance...

Buran


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was...
3
by: Steve Macleod | last post by:
Hi, I am using the following code to initialise a session, depending on whether-or-not the users' log in attempt has been successful. if ($session_ok == "TRUE") { //open the session...
3
by: George | last post by:
VS.NET 2002\Web\VB I am trying to get the referring URL for one of my pages using this: Request.UrlReferrer.ToString Page 1 has a link to Page 2. I click on the link in Page 1, and go to...
1
by: Magnus Johansson | last post by:
I have installed SP2 for XP, and after this I can not create a new Visual Studio ASP.Net Web Application - get the errormessage: "Visual Studio .NET has detected that tthe specified Web server is...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
5
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>"...
2
by: paladin | last post by:
We have a strange situation where some of the referring URL's are missing from our log files. This is on .NET application on IIS 6.0. Here is what is happening: Page a.aspx has a form that...
4
by: CG | last post by:
Hi I need to implement some low level security that locks a certain page if the user does come from a particular link (which is hosted on another domain). I've considered using HTTP_REFERER...
9
by: tomrue | last post by:
I'm looking for a way to prevent access to a web page except from a particular referring page. What I am trying to do is prevent access to a download page for anyone who has not successfully...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.