guest
  • #1  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
Hi, I've just recently downloaded and installed YAF for a client, but I'm having a little bit of trouble integrating it into the current project. Authentication( with yaf stored procedure) works fine but its not setting the cookie to authenticate the user on the forum, although the code is almost the same as the login.acx page. heres the source if anyones interested.

If NewUser.DeCrypt(NewUser.password) = UCase(txtPassword.Text) Then
                    Dim dl As New DataLayer()
                    Dim params As Object() = {1, txtUserID.Text,FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.ToUpper(), "md5")}
                    Dim uID As Integer = dl.execScalar("yaf_user_login", params)
                    If uID > 0 Then
                        Dim idName As String = String.Format("{0};{1};{2}", uID, 1, txtUserID.Text)


                        'User is valid...
                        Label1.Text = NewUser.FirstName & " " & NewUser.LastName

                        LoadSessionVariables(NewUser)
                        FormsAuthentication.SetAuthCookie(idName, False)
                        Response.Redirect("main.aspx", False)
                    End If

it all executes fine and returns the uID but its not setting the session. both folders are virtual directories the yaf forum is located in the root/forum/ folder. Thanks.
Ederon
  • Posts: 902
  • Joined: 07/01/2007
If you want to share authentication, you have to use the same authentication settings in web.config IIRC.
When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
UserPostedImage 
guest
  • #3  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
hmm, could you provide an example of this? Thanks for the help its much appreciated.
Ederon
  • Posts: 902
  • Joined: 07/01/2007
web.config of both applications should share this part.
	<system.web>

		...

		<authentication mode="Forms">
			<forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies"/>
		</authentication>

		<machineKey validationKey="YOUR_KEY" decryptionKey="YOUR_KEY" validation="SHA1"/>

		...

	<system.web>

When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
UserPostedImage 
guest
  • #5  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
Yes! worked perfectly, thank you very much sir. :d
Kai2
  • Posts: 16
  • Joined: 15/07/2008
Great! The machinekey-entry also fixed my problem, thanks a lot 😎 Just in case anyone else needs it: Here  is a quite useful article about machine keys, especially the MachineKey Generator  was a big help for me. :idea: You only need to copy the generate lines to both your application and YAF (in addition to the authentication node of course).
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved