Results 1 to 17 of 17

Thread: [RESOLVED] URLReferrer and Object not set problem

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Location
    Indiana
    Posts
    451

    Resolved [RESOLVED] URLReferrer and Object not set problem

    Hello,

    I am creating a message page that displays a message, then returns the user to the referrer, but I am having a problem.

    The error I get is that an object reference is not set. Is there a problem getting the referrer in the page load event?

    Here is my code.

    VB Code:
    1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    2.  
    3.         Me.lblMessage.Text = Page.Request.QueryString("Message").ToString
    4.  
    5.         Dim GotoURL As String
    6.  
    7.         If Not Page.Request.UrlReferrer Is Nothing Then
    8.             GotoURL = Page.Request.UrlReferrer.AbsoluteUri
    9.         Else
    10.             GotoURL = Page.Request.UrlReferrer.ToString <---- Error on this line
    11.         End If
    12.  
    13.         Page.Response.AppendHeader("Refresh", "5; url=" & GotoURL)
    14.  
    15.     End Sub

    I understand the error(I think), but I am not sure how that applies in this situation, or how to fix it. I should also mention that I am passing a variable thru the querystring to this page. Would that affect it?

    BTW, I found this code on this site while I was searching for a solution. I originally just had the Page.Response.UrlReferrer.ToString.
    Last edited by Krenshau; Nov 17th, 2006 at 04:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width