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:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.lblMessage.Text = Page.Request.QueryString("Message").ToString Dim GotoURL As String If Not Page.Request.UrlReferrer Is Nothing Then GotoURL = Page.Request.UrlReferrer.AbsoluteUri Else GotoURL = Page.Request.UrlReferrer.ToString <---- Error on this line End If Page.Response.AppendHeader("Refresh", "5; url=" & GotoURL) 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.




Reply With Quote