Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request.UrlReferrer error

Status
Not open for further replies.

logi2000

Programmer
Jun 17, 2003
221
CR
every time i do this Request.UrlReferrer().ToString
i get the following eror:

Object reference not set to an instance of an object.

how can i fix that ?
 
log: I tried the following code:

....
<%@Import Namespace = &quot;System&quot;%>
<%@Import Namespace = &quot;System.MarshalByRefObject&quot;%>
<%@Import Namespace = &quot;System.Uri&quot;%>
....

Private Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim MyUrl As Uri = Request.UrlReferrer
Response.Write(&quot;Referrer URL Port: &quot; & MyUrl.Port)
End IF
End Sub

..and received the same error that you did. However, when I opened this page from a &quot;previous&quot; page (i.e., I put Test.aspx on a button on another aspx page directing it to this page) it worked fine. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top