Posted by: rmcbride@rama.com - Saturday, 25 April 2009 08:13:35
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
Posted by: rmcbride@rama.com - Saturday, 25 April 2009 08:33:49
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.
Posted by: rtwPhoenix - Sunday, 26 April 2009 08:22:24
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
Posted by: rmcbride@rama.com - Sunday, 26 April 2009 08:45:25
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
Posted by: bbqchickenrobot - Sunday, 26 April 2009 14:29:23
[quote=rmcbride@rama.com]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.
[/quote]
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.
Posted by: rmcbride@rama.com - Monday, 27 April 2009 06:49:28
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
Posted by: rmcbride@rama.com - Monday, 27 April 2009 08:50:13
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
Posted by: Epstone - Monday, 11 May 2009 06:59:36
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
Posted by: rmcbride@rama.com - Monday, 11 May 2009 08:03:32
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
Posted by: cartaysm - Monday, 11 May 2009 18:37:00
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.
First I have 2 websites, 1 running at http://mysite.com... The other running at http://forums.mysite.com
What I wanted to do is when logging into http://mysite.com you would automatically be logged into 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.
(What I did is simply change 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);
Posted by: Epstone - Tuesday, 12 May 2009 01:19:22
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
[/quote]
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
[/quote]
Thanks! It would be great if I could use the forum for my site soon :)
Epstone
Posted by: rmcbride@rama.com - Monday, 18 May 2009 07:21:34
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.
Posted by: Epstone - Monday, 18 May 2009 07:54:19
Thanks for that idea, but no... its still not working ;)
I will try set another server up soon...
Posted by: rmcbride@rama.com - Monday, 18 May 2009 08:25:15
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
Posted by: Epstone - Tuesday, 19 May 2009 04:40:13
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
Posted by: rmcbride@rama.com - Tuesday, 19 May 2009 14:53:53
Hi Epstone
I recreated your environment almost completely and cannot replicate the problem. The only differences are that I am using 32bit (but I did it in 64 bit too) and SQL Server (but I am using SQL Express on my dev boxes).
What about the following keys in your app.config file? They should be as shown below.
Let's try to avoid the remote session for now, until we have done the ritual troubleshooting stuff.
Thanks
Richard
Posted by: rmcbride@rama.com - Tuesday, 19 May 2009 18:41:54
Hi Epstone
You might also want to follow http://forum.yetanotherforum.net/yaf_postst8463_Error-Line-33-of-pagesadminadminascx.aspx.
This is another person with a similar problem, and the guy helping him is WAAAAAAAY more experienced than me.
Thanks
Richard
Posted by: Epstone - Wednesday, 20 May 2009 00:34:25
Okay thanks for that tip, I will follow this thread! My App.config is correct.
Could you post your web.config of your main application? I have just a fresh setup at the moment and cannot understand what else could be wrong...
I think the link above is not working, maybe this one :)
http://forum.yetanotherforum.net/yaf_postst8463_Error-Line-33-of-pagesadminadminascx.aspx
Posted by: rmcbride@rama.com - Wednesday, 20 May 2009 06:21:18
Hi Epstone
I will go one better. My website hosts a lot more than YAF and thus has many other entries. So rather than post my web.config I will build a virtual machine today that is as close to yours as I can get. Then I will set up YAF on that machine. Then I will post the web.config from that machine.
It will take me much of the day to get this done so don't look for the web.config until tomorrow.
Thanks
Richard
Posted by: Epstone - Wednesday, 20 May 2009 06:29:26
Wow, thank you!!! Maybe the guys in the other thread will find a solution earlier, so dont't work to fast ;)
Posted by: Smartie - Monday, 1 June 2009 05:41:07
Hey,
My site is written in VB.Net so I cannot move the app_code files into the base app_code folder. Any ideas?
Posted by: Epstone - Wednesday, 3 June 2009 01:26:56
Hello Richard,
I switched now to the membership system of YAF and my forum is almost working like it should. There are just some optical issues left which I described
[url=http://forum.yetanotherforum.net/yaf_postsm34719_Using-Master-Pages-problem.aspx#post34719]here[/url].