Problem with editing portal items - Request.UrlReferrer ,Object reference not set to an instance of an object.
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngibuyspy' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Alan Flaherty
Hi list,

I keep getting this error with the portal, what is happening to
Request.UrlReferrer ? why is it not being received. I seen others on the
list with the same problem but no resolution. I added the page URL as a
parameter in the DesktopModuleTitle.aspx.cs but there must be a way of
doing this properly.

Thanks

Alan

Server Error in '/PortalCSVS' Application.
------------------------------------------------------------------------
--------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:

Line 84:
Line 85: // Store URL Referrer to return to portal
Line 86: ViewState["UrlReferrer"] Request.UrlReferrer.ToString();
Line 87: }
Line 88: }

Source File: C:\PortalCSVS\PortalCSVS\DesktopModules\EditLinks.aspx.cs
Line: 86

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
ASPNetPortal.EditLinks.Page_Load(Object sender, EventArgs e) in
C:\PortalCSVS\PortalCSVS\DesktopModules\EditLinks.aspx.cs:86
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724

------------------------------------------------------------------------
--------
Reply to this message...
 
    
Graham Auty
MessageAlan,

I've had the same problem and in fact replied to a similar post on this
newsgroup a while back, but it's worth repeating here.

Basically, I reckon it's down to your firewall. I have Norton Personal
Firewall running on my machine, and it came up with the same thing. If you
can disable or bypass the firewall temporarily, and try IBuySpy Admin again,
it will probably work.

In my case, the firewall was blocking the ability of the web site to collect
information about where you have come from to get to the page you are on.
This is a privacy feature to prevent web sites tracking your movements on
the Web. However, in the case of IBuySpy, the "ViewState("UrlReferrer") =
Request.UrlReferrer.ToString()" code you mentioned is the way it remembers
where to go back to when you've finished editing or adding database items.

You may be able to knock off the setting in your firewall to allow you to
run this code. However, a better solution would be to change the way this
code works so that it doesn't rely on UrlReferrer, as any site you deploy
based on this code will not work for people who are firewalled in the way
described.

Since you may need to remember multiple levels of where to return, you need
to implement a stack - the easiest way to do this is probably via the
Session object.

Graham Auty
Cinnamon Systems Ltd

Reply to this message...
 
    
Brian Bilbro (VIP)
MessageIt's prefectly valid for the referer to be null sometimes. There is only a referer if the page was accessed via a link off of another page. If you just type in the url directly within the browser than that page doesn't have a referer. You need to write the code to reflect this possibility:

if(Request.UrlReferrer!!=null)
{
ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
}

HTHs
Brian

----- Original Message -----
From: Alan Flaherty
To: aspngibuyspy
Sent: Friday, July 19, 2002 1:26 PM
Subject: [aspngibuyspy] Problem with editing portal items - Request.UrlReferrer ,Object reference not set to an instance of an object.

Hi list,

I keep getting this error with the portal, what is happening to Request.UrlReferrer ? why is it not being received. I seen others on the list with the same problem but no resolution. I added the page URL as a parameter in the DesktopModuleTitle.aspx.cs but there must be a way of doing this properly.

Thanks

Alan

Server Error in '/PortalCSVS' Application.

--------------------------------------------------------------------------------

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 84:

Line 85: // Store URL Referrer to return to portal

Line 86: ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();

Line 87: }

Line 88: }

Source File: C:\PortalCSVS\PortalCSVS\DesktopModules\EditLinks.aspx.cs Line: 86

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]

ASPNetPortal.EditLinks.Page_Load(Object sender, EventArgs e) in C:\PortalCSVS\PortalCSVS\DesktopModules\EditLinks.aspx.cs:86

System.Web.UI.Control.OnLoad(EventArgs e) +67

System.Web.UI.Control.LoadRecursive() +29

System.Web.UI.Page.ProcessRequestMain() +724
Reply to this message...
 
    
Narayanan Raghavan
------------------------------
From: Narayanan Raghavan

I am having the same problem. I get an Object reference not set to an instance of an object whenever I try to access UrlReferrer.
I have a page DesktopDefault.aspx where I have added a user control for login and registeration. with a linkbutton. On click i do a Response.Redirect to my registeration page.

On the page load of the registeration page I am trying to just print the urlreferrer by
Response.Write(Request.UrlReferrer.ToString());

and I get this error. This happens in the Debug mode of the application. On the release mode i get a blank white page when i click the linkbutton.

Also, everything works fine with Netscape. Its only IE that screws up and reports the error. When I switched on trace to see what was going on i found that the Control Tree was messed up in IE but Netscape was just fine.
Thanks
narayanan
Reply to this message...
 
    
Stephen Gray
I had the same problem but as soon as I disabled "Norton Internet Security" it worked.

No idea how to get round this problem other than keeping it disabled .. which obviously I don't want to do

:-|

Regards

Steve
Reply to this message...
 
 
System.EventArgs
System.NullReferenceException
System.Web.UI.Control
System.Web.UI.Page




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com