Anonymous access to threads fails


As an anonymous visitor I get an System.NullReferenceException on line 244 (thread.aspx) when I try to open an existing thread
--> Dim CurrentGUID As Guid = Membership.GetUser().ProviderUserKey() throws
Closed Dec 9, 2009 at 6:20 AM by z2bass
fixed in v3 preview


ninjaduke wrote Aug 21, 2007 at 12:03 AM

I'm having the same problem! but it's not only doing that in anonymous access, it's also doing it for every user except administrators.. The only way to view threads is logged in as administrator..

ERROR: Object reference not set to an instance of an object.

---> Dim CurrentGUID As Guid = Membership.GetUser().ProviderUserKey() throws

Ln 270 Col 9 Ch 9

Visual Studio ProfessionalClub Starter Kit 3 beta 1

mnebinger wrote Aug 22, 2007 at 1:05 PM

I don't use the forums, but here is the fix for the anonymous access failing.

replace the lineDim CurrentGUID as Guid = Membership.GetUser().ProviderUserKey() With:Dim CurrentGUID as Guid Try CurrentGUID = Membership.GetUser().ProviderUserKey()Catch Return FalseEnd Try

All this function is trying to do is see if the user viewing the thread is the person that started the thread. So if the user is anonymous, it is safe to return False. The reason it is throwing an exception is that the line is trying to check the current users GUID through the database. If they are anonymous, they will not be in the database so ProviderUserKey is a null reference.

wrote Dec 9, 2009 at 6:20 AM

wrote Feb 14, 2013 at 3:37 AM

wrote May 16, 2013 at 7:46 AM