guest
  •  guestTopic Starter
  • Guest
2007-09-05T10:20:50Z
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.
Sponsor
Ederon
2007-09-05T11:14:08Z
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
  •  guestTopic Starter
  • Guest
2007-09-05T19:18:11Z
hmm, could you provide an example of this? Thanks for the help its much appreciated.
Ederon
2007-09-05T22:53:06Z
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
  •  guestTopic Starter
  • Guest
2007-09-06T11:08:26Z
Yes! worked perfectly, thank you very much sir. :d
Kai2
  •  Kai2
  • YAF Camper
  • 60.2% (Friendly)
2008-07-18T21:37:20Z
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).

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