Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 8th, 2008, 08:29 AM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dim user As MembershipUser = Membership.GetUser(us

My error says: "ArgumentNullException was unhandled by user code. The value cannot be null. Parameter name: userName"

Here is the code (VB version of page 177, bottom most block):
Code:
' retrieve the username from the querystring
            userName = Me.Request.QueryString("UserName")

            lblRolesFeedbackOK.Visible = False
            lblProfileFeedbackOK.Visible = False

            If Not Me.IsPostBack Then
                UserProfile1.Username = userName

                ' show the user's details
                Dim user As MembershipUser = Membership.GetUser(userName)


Any ideas?
  #2 (permalink)  
Old May 8th, 2008, 02:20 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

When you navigate to this page, is the UserName in fact on the querystring? (...aspx?UserName=blahblah)

If it is not, then Me.Request.QueryString("Username") would return a null value, which would cause Membership.GetUser to throw an ArgumentNullException.

  #3 (permalink)  
Old May 8th, 2008, 03:42 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK. Great. I just tried navigating from a different page. I didn't realize it was dependant on where I was navigating from. That makes total sense now.
Thanks for the help!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Membership / User question rsearing ASP.NET 3.5 Professionals 29 February 21st, 2009 12:45 PM
Membership User kulkarnimonica ASP.NET 2.0 Professional 2 July 12th, 2007 04:55 PM
problem with creating membership user hertendreef ASP.NET 2.0 Basics 1 April 9th, 2007 02:37 PM
Editing a MembershipUser without changing it’s log madok BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 13th, 2006 09:42 PM
Migrate user data to new membership model relaytest49 ASP.NET 2.0 Professional 2 May 24th, 2006 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.