473,804 Members | 3,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Refe rrerURL") = Request.UrlRefe rrer.ToString()
LoadData()
End If

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

Buran
Nov 18 '05 #1
2 2332
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.co m> wrote in message
news:#M******** ******@TK2MSFTN GP12.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("Refe rrerURL") = Request.UrlRefe rrer.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*******@hotm ail.com> wrote in message
news:#V******** ******@TK2MSFTN GP09.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.co m> wrote in message
news:#M******** ******@TK2MSFTN GP12.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("Refe rrerURL") = Request.UrlRefe rrer.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
9891
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 clicked in the left frame? I'd like to avoid having to use a name/value pair in the links in the left frame, which I'm currently doing. I'd prefer to use something similar to $_server('REFERER') but I can't find anything that would list the...
3
4435
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 session_start(); //assign user details to session $_SESSION = $user_id; $_SESSION = $user_pass;
3
2223
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 Page 2. Page 2 is where I am trying to get the referring URL. However, instead of getting the URL of Page 1 (the referring page), I get the URL of the Page 2 (the current page), instead.
1
1344
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 not running ASP.NET version 1.1..." I have runned aspnet_regiis /i. Reinstalled IIS (5.1), ASP.NET framework 1.1, Visual Studio 2003. Installed every hotfix and service pack I could find for Visual Studio and
3
3134
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 that I can check for the existance of a parameter value in that previous querystring.
5
3253
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+"'>" +referring page title +"<a>"). I have looked into using location.history also. This is probably a standard thing, but through all the forums and searches I only find a mishmosh of things referring to using frames, a different scripting language, etc....
2
2296
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 POST's to a.aspx. If there are errors with the form information, then a.aspx is displayed with an error message to the user. If all the information is correct then it is redirected (response.redirect) - GET to page b.aspx. In this GET to b.aspx (and
4
2409
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 variable but seems this is a little shaky as it is not alway set. Does anyone have a solution that would allow me to restrict. I figure I can't use a session as it is linked from another domain - same with cookies.
9
2663
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 completed an online quiz. Any ideas on how to this in php (using Drupal) would be most appreciated. Thanks.
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.