Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: mysterious code


Message #1 by "Dan McKinnon" <mddonna@q...> on Thu, 6 Jun 2002 00:55:32
Hi -

In ASP.NET Pro I came across this code that is puzzling to me. Can anyone 
explain it to me? It seems to be saying that if a certain variable doesn't 
exist, then to put that nothing into the queryString. 

This code is part of an application that, if the user requests certain 
secure pages, he or she is first sent to a login page. In order to go back 
to the page before the login page, the page he or she came from is stored 
in the returnURL variable. But this code makes no sense to me.

Sub Page_Load(sender As Object, e As EventArgs)
		
     ' Store Return Url in Page State
     If Request.QueryString("ReturnUrl") Is Nothing Then
		ReturnUrl.Value = Request.QueryString("ReturnUrl")
     End If
		
End Sub

Thank you,
Dan
Message #2 by "Jonothon Ortiz \(Xnext, Inc\)" <jon@X...> on Wed, 5 Jun 2002 19:59:18 -0400
Did you check the Errata?
Message #3 by "Dan McKinnon" <mddonna@q...> on Thu, 6 Jun 2002 09:26:11
> Did you check the Errata?

I have to admit I didn't think of that this time, though I have with other 
books. I just assumed it was me.

I did however check the errata and it was not listed. The code sample from 
my other post is from the register.aspx page of the case study 
IBuyAdventure in chapter 24. Furthermore I looked at the downloaded source 
code and it is identical to the book. 

I also found this code in the login.aspx page also, which is similar.

Sub Page_Load(sender As Object, e As EventArgs)
		
   ' Store Return Url in Page State
   If Request.QueryString("ReturnUrl") = "" Then
	ReturnUrl.Value = Request.QueryString("ReturnUrl")
    RegisterUser.NavigateUrl = "Register.aspx?ReturnUrl=" & ReturnUrl.Value
   End If
	
End Sub

  Return to Index