trying Posts 1
|
Hello, I'm using the your forum on a clients site, I'm also using it as an intergrated forum connecting to an in place membership system. My problem is none of the user name appear in the Lastest POst section. If I use a GetHashedCode . Otherwise it bombs out.
I have found out the reason, I Guess, not know knowing your system in it's entirety.
Also, I have the non-code version, I read the boards and have seen that this was issue for others, but read that this was fixed in the next release. This was in 2007 that post was posted, I purchased this copy only several weeks ago .
I get. '******************************************************************************* Specified cast is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Specified cast is not valid.] aspnetforum.ForumPage.get_CurrentUserID() +99 aspnetforum.ForumPage.OnInit(EventArgs e) +107 System.Web.UI.Control.InitRecursive(Control namingContainer) +321 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834 '*******************************************************************************
This is my code:
'******************************************************************************* If Page.User.Identity.IsAuthenticated = True Then Dim UseName As String Dim UserId As String Dim MemUser As MembershipUser MemUser = Membership.GetUser() UseName = Trim(MemUser.UserName.ToString()) UserId = Trim(MemUser.ProviderUserKey.ToString)
Session("username") = UseName Session("aspnetforumUserID") = UserId Session("aspnetforumUserName") = UseName End If
End If '*****************************************************************************
What I believe to be the issue is, With this code it works because I get the hashed value but it has no relation to user because it is a hashed value.
'***************************************************************************** If Page.User.Identity.IsAuthenticated = True Then Dim UseName As String Dim UserId As Integer Dim MemUser As MembershipUser MemUser = Membership.GetUser() UseName = Trim(MemUser.UserName.ToString()) UserId = Trim(MemUser.ProviderUserKey.GetType.GUID.GetHashCode)
Session("username") = UseName Session("aspnetforumUserID") = UserId Session("aspnetforumUserName") = UseName
End If
Thanks, My deadline is fast approaching edited by trying on 5/15/2008
|