Problems with HTTP_REFERER

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi, I have the following code in my ASPX:
private string pagina =
System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"].ToUpper());

The problem is it: When i call this page directly i get an error:


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.



I really need that, but i do not know how to accomplish this. Does someone
can help me ?


.



Relevant Pages

  • System.NullReferenceException: Object reference not set to an inst
    ... I have several pages written in aspx, but sometime the aspx page return the ... Object reference not set to an instance of an object. ... For jobs in this status, ... 'MM/DD/YYYY') expecteddate, k.location from rel_device d, rel_tests t, ...
    (microsoft.public.dotnet.framework.aspnet)
  • IDE-induced object reference error?
    ... I have an aspx page that was working brilliantly earlier today, ... "Object reference not set to an instance of an object." ... Now, I may have made the edit while my page was in debug mode, but I don't ... * replacing the entire fileset with fresh copies that my ...
    (microsoft.public.vsnet.ide)
  • IDE-induced error?
    ... I have an aspx page that was working brilliantly earlier today, ... "Object reference not set to an instance of an object." ... Now, I may have made the edit while my page was in debug mode, but I don't ... * replacing the entire fileset with fresh copies that my ...
    (microsoft.public.vsnet.general)
  • ide-induced error?
    ... I have an aspx page that was working brilliantly earlier today, ... "Object reference not set to an instance of an object." ... Now, I may have made the edit while my page was in debug mode, but I don't ... * replacing the entire fileset with fresh copies that my ...
    (microsoft.public.dotnet.general)
  • Re: Problems with HTTP_REFERER
    ... will throw an exception if the string is null. ... I have the following code in my ASPX: ... > Object reference not set to an instance of an object. ...
    (microsoft.public.dotnet.framework.aspnet)