Welcome Guest Search | Active Topics | Log In | Register

Problem integrating YAF into my web site Options · View
Ernie Curto
#1 Posted : Friday, August 08, 2008 9:48:26 PM

Rank: YAF Forumling


Joined: 8/8/2008
Posts: 1
Location: Sacramento, CA
I am trying to integrate YAF into my web site. I cannot get the login to synchronize between the site and YAF. I can log into the site, but YAF does not show the person logged in when I go to the forum page. When I log into YAF from the forum page, I get logged into the forum, but I get logged out of my site. From the debugger for the login button, I can see that the userID is correctly obtained from the YAF database.
I am using .net for the site. In my visual studio code I have a folder called yaf that holds the install for the forum. For my site I am using the .net authentication. In the sites root directory I have the web.config and yafnet.config files. Below are the code for these files and the login for my site.

Does anyone know what the problem is for the dual login.

Thanks.



Web.config file

<?xml version="1.0"?>
<configuration>
<!-- Additions for YAF-->

<configSections>

<section name="yafnet" type="yaf.SectionHandler,yaf"/>
<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>



</configSections>

<yafnet configSource="yafnet.config"/>
<rewriter configSource="urlrewriter.config"/>
<!-- End of YAF additions-->

<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!-- Additions for YAF-->

<!-- Add code for dual login between Visual Studio login and YAF login -->
<machineKey validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="AES"
decryption="Auto" />

<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter"/>
</httpModules>

<sessionState mode="InProc" cookieless="false" timeout="30" />
<httpCookies httpOnlyCookies="false" />

<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
<compilation defaultLanguage="c#" debug="true"/>
<pages enableEventValidation="false" validateRequest="false" smartNavigation="false"/>
<authentication mode="Forms">
<forms name="pontisForum" timeout="525600"/>
</authentication>
<roleManager enabled="true" />

</system.web>
<system.net>

</system.net>
</configuration>



yafnet.config file
<yafnet>
<root>pug/yaf</root>
<connstr>user id=pug??;pwd=??????;data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True;timeout=20</connstr>

<uploaddir>~/pug/upload/</uploaddir>
<boardid>1</boardid>
<enableurlrewriting>false</enableurlrewriting>
</yafnet>



C# code for the login button on the site login page
protected void LoginButton_Click(object sender, EventArgs e)
{
string sPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(Login1.Password, "md5"Wink;
object userID = yaf.DB.user_login(1, Login1.UserName, sPassword);
if (userID != DBNull.Value)
{
string idName = userID.ToString();
if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(idName, false);
}
else
{
FormsAuthentication.SetAuthCookie(idName, false);
yaf.Forum.Redirect(yaf.Pages.forum);
}
}
}
Users browsing this topic
Guest
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.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.127 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET