YAFLogo

rmcbride@rama.com
15 years ago
Hi all

The attached file represents the steps I took to get a working-ish YAF installation in a sub-directory with asp membership already in place. There are a couple of issues outstanding, but these steps are highly repeatable and immediately accept the asp membership members into the YAF forum.

Thanks

Richard
Sponsor

rmcbride@rama.com
15 years ago
Hi all

An addition to this file. I forgot to include that you need to comment out the following from the YAF web.config if you are using the asp membership provider.

The problem is that I am not sure what cookieless and timeout might affect, so I also modified my own forms line in my root web.config to include these parameters, but am not including this in the document until I know for sure what they actually do.

In addition the YAF web.config contains an "authetication" line that will conflict with your
web.config's existing authentication line. Open the yaf web.config and look for the following.





Comment out this section.

rtwPhoenix
15 years ago
Hello, what are the few little problems with membership? What I read was everyone was logged in as a guest is that correct?

I think the product is great. I am learning more each day of use. Intergration into exisitng web pages is a plus with membership since we use the membership schema almost on every LOB site.

Thanks to all of you for doing such a great job.

:p
rmcbride@rama.com
15 years ago
Hi rtwPhoenix

Depending on your configuration, you will get "Object not found" or "Object reference not set" on some of the elements of the forum. This looks to be due to the use of a yaf specific provider set. The problem is that when you use the asp provider, some of the yaf custom elements are not included.

We are working on this right now and I will post here once there is a solution.

Thanks

Richard
bbqchickenrobot
15 years ago
rmcbride@rama.com wrote:

Hi all

An addition to this file. I forgot to include that you need to comment out the following from the YAF web.config if you are using the asp membership provider.

The problem is that I am not sure what cookieless and timeout might affect, so I also modified my own forms line in my root web.config to include these parameters, but am not including this in the document until I know for sure what they actually do.

In addition the YAF web.config contains an "authetication" line that will conflict with your
web.config's existing authentication line. Open the yaf web.config and look for the following.





Comment out this section.



Cool that you wrote this up, just went through this same experience myself and was going to create a write-up, but looks like you beat me to it.

There were a few issues, but those were fixed via a few minor code changes.
rmcbride@rama.com
15 years ago
Hi bbqrobotchicken

I know this is a repeat request from another area, but I just have to ask!

If there is any way you could repeat your process and document what you did, that would be extreeeeeeemely useful to the rest of us. There seem to be a lot of us who are having difficulty with the asp membership integration, especially around the provider.

I know you are running in a decompiled environment, but not all of us can do that. Therefore if we can find what changes you made, we can either create a document work-around (even though it might mean a decompiled setup) or we can recompile with your changes.

Your help here would be really appreciated.

Thanks

Richard
rmcbride@rama.com
15 years ago
Hi All

WOOHOO! We have a winner. In a semi-related topic in another thread, flow7oo said he had successfully installed using a classic-mode pool instead of the default pool in IIS. I just tried that, and my problems went away!

So this needs to be documented. Perhaps it is somewhere and I missed it.

Thanks to flow7oo and others for your help.

Richard
Epstone
  • Epstone
  • 56.6% (Neutral)
  • YAF Forumling
15 years ago
Hello Richard,

thanks a lot for your work! I followed your installation guide and have the forum now installed in the "/forum" subdirectory. After the installation wizzard I can now see the forum main page.:-d

And I know that my standard asp membership provider is working correctly for logging in, registering... scnd:-d

But... I get null exceptions when I try to open either the "Admin" area or the "Members" Area. Do you have a solution for this? Or have I overseen something?

Thanks!
Epstone
rmcbride@rama.com
15 years ago
Hi Epstone

When I saw this error I set the forum's Application Pool from DefaultAppPool to Classic .NET. It has something to do with the way IIS expects authentication to work. YAF is built on the Classic model.

Let me know if this solves your problem.

Thanks

Richard
cartaysm
  • cartaysm
  • 58.4% (Neutral)
  • YAF Forumling
15 years ago
For what its worth:
I got around integration with one minor error, the page has to be refreshed before the user is recognized that's it. So I will break it down real quick.
http://forums.mysite.com 
http://forums.mysite.com . The reason I needed this was because mysite.com viewed forums.mysite.com via an iframe.
http://mysite.com  does not use memberships
http://forums.mysite.com  does use memberships
So there is a run down of what I was working with. Here is my fix:

First write a stored procedure to add all the fields into the YAF database:
yaf_prov_Membership
yaf_prov_RoleMembership
What this will do is when registered for mysite.com it automatically adds the users into the YAF database.

Second add the dll's from the forum to your bin (just the YAF) and next (this will take some digging so don't try it if you dont know what you are doing), but you need to pull out the salt generator and put it in your code via YAF SOURCE\YAF.Providers\Membership\YafMembershipProvider.cs
with that you can now generate the same salts as yaf.

Next call the salt and add it to this string below.
Dim Hashedpass As String = YAF.Providers.Membership.YafMembershipProvider.Hash(clearText, "SHA1", Salt, True, False, "", "", False)

What this does is generate the exact hashed password that YAF does. So if you store the salt and the hashed password you have successfully stored exactly as YAF.

So on your login page you would simply not generate the salt. You would pull the salt from your database and place it in the string above.
http://mysite.com  database to hold salts. What this does is saves the password and salt exactly like YAF, easy to recall.)

Finally: and this is where my error comes in, I just have this code in the wrong spot. But you add a forums auth ticket YAF forums will know who you are. I added it on the default page so my forums site requires a refresh before working but this can easily be fixed.

So just put the username in and role id from the yaf database and thats it. Works like a charm

FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, Username, DateTime.Now, DateTime.Now.AddMinutes(60), false, RoleID);
String encTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
Response.Cookies.Add(faCookie);

Epstone
  • Epstone
  • 56.6% (Neutral)
  • YAF Forumling
15 years ago
As I'm using IIS 6 and switching to classic mode seems not to be a possible solution for me, so maybe someone has another idea. I hope I can can digg deeper into the yaf sources soon but at the moment I would be glad if I could stay on the user side 😉 My main goal is to integrate the forum into the master page of my main page.

I get null exceptions if I try to enter either the Admin or the Members section. And here they are:

Admin:
Quote:



Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.forum_pages_admin_admin_ascx.__DataBind__control4(Object sender, EventArgs e) +273
System.Web.UI.Control.OnDataBinding(EventArgs e) +131
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +169
System.Web.UI.Control.DataBindChildren() +11020703
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +674
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +68
System.Web.UI.Control.DataBindChildren() +11020703
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
System.Web.UI.Control.DataBindChildren() +11020703
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
YAF.Pages.Admin.admin.BindData() +265
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428



Members
Quote:



[NullReferenceException: Object reference not set to an instance of an object.]
ASP.forum_pages_members_ascx.__DataBind__control4(Object sender, EventArgs e) +500
System.Web.UI.Control.OnDataBinding(EventArgs e) +131
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +169
System.Web.UI.Control.DataBindChildren() +11020703
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +674
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +68
System.Web.UI.Control.DataBindChildren() +11020703
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
YAF.Pages.members.BindData() +937
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428



Thanks! It would be great if I could use the forum for my site soon :)
Epstone
rmcbride@rama.com
15 years ago
I know this is an almost impossibly silly question, but have you rebooted your server (or restarted SQL Server) lately?

I did a fresh install and got a null object reference error. Then I restarted SQL Server and the error went away.
Epstone
  • Epstone
  • 56.6% (Neutral)
  • YAF Forumling
15 years ago
Thanks for that idea, but no... its still not working 😉
I will try set another server up soon...
rmcbride@rama.com
15 years ago
Hi Epstone

Can you describe your configuration and I will see if I can replicate it? What server os, sql version, iis, and any other components or applications on your website?

Thanks

Richard
Epstone
  • Epstone
  • 56.6% (Neutral)
  • YAF Forumling
15 years ago
Sure, thats the system:

win2k3 64bit, SQL Express 2008, IIS6, .NET 3.5 SP1

Today I created new membership tables with the aspnet_regsql tool. But I still have the same errors when trying to enter the admin or members section. I can login or register, no problems there. :?

The forum is in the subdirectory /forum.

If you want we could do a small remote session?
thanks!
Epstone
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
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