YAFLogo

phaedoHD
  • phaedoHD
  • 68% (Friendly)
  • YAF Forumling Topic Starter
14 years ago
i too am getting that error and i too have put the root key in correctly and copied the dll's over to the main bin folder.

I don't know if this would make a difference, but in my case because i compiled the yaf to asp.net 3.5 then i now obviously have 2 App_Code dll's when i publish, so i just re-named the yaf one to App_Code2.dll, which i was told shouldn't matter because it will just automatically look through the dll's in the bin folder, so the name doesn't matter.
billyboy
14 years ago
If everyone doesn't mind waiting a few days...

I am winding down testing and need to move everything into production, soon. I will develop a step-by-step from that (have to do evrything again). Currently using .net 2.0 with (gasp) VWD 2008 Express, hopefully the majority of it will apply to y'all.

Just hold on...

phaedoHD
  • phaedoHD
  • 68% (Friendly)
  • YAF Forumling Topic Starter
14 years ago
Thanks! that will be great :-)

billyboy
14 years ago
I added a short guide to merging the web.config files, let me know what you think

http://wiki.yetanotherforum.net/Merge%20web.config%201.9.3.ashx 

thanks!

more coming, hopefully monday or tuesday...

Ok, tuesday.

If someone else has had success maybe they could edit or at least confirm.

Link 
billyboy
14 years ago
Ok, I found some problems, especially with my instructions. I need to work through them and get it fixed, basically the instructions work; however, I have an issue with my forums being disabled for all users, it maybe I'm missing a step. I'll let everyone know.
billyboy
14 years ago
Ok, I had meesed up my profile provider and it's connection type to the db. I lfet out the inheritance to the yaf provider and connection. Additionally my application, on user registration set each user with a defualt role that I ahd not mapped as "Is Start" in YAF. silly thing but evryone was a guest even when logged in, except of course the admin.
wesclyburn
14 years ago
Integrating is really very simple. Honest. The only complexity is that if you're using 3.5, you'll need to let VS convert the projects and rebuild the assemblies.

I put up a sample on my skydrive  of a 3.5 site with yaf integrated as a subdirectory.

1. ASP.NET 3.5, buildable with VS2008 or VWD2008
2. Uses standard SqlMembership/Role/Profile providers (aspnet_regsql already run against the database)
3. Configured to run in Medium Trust
4. Forums use the same Master Page as the home page.
5. YAF is C#; everything else is VB.NET (not that one language is better than the other; just to show it's no big deal to use YAF in a VB site).

If you're having trouble with your integration, compare the directory structure, App_Code, and the config files (especially the "root" key in ./config/appSettings.config).

https://yafdotnet.svn.sourceforge.net/svnroot/yafdotnet/trunk/yafsrc 

I'm almost done with a branch that uses standard ASP.NET themes and globalization instead of the system yaf currently employs, to make it even easier to integrate. Total nightmare, and I really doubt Jaben will merge with 1.9.3 since it's a major change and they're so close to full release. So if you need this, PM me.
phaedoHD
  • phaedoHD
  • 68% (Friendly)
  • YAF Forumling Topic Starter
14 years ago
thanks for the sample! I was successfully able to integrate it with my app. It now builds/publishes fine and all the non-forum part of the site works perfectly.

However, when i access ~/forum/default.aspx i get the following error:


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.

Source Error:

Line 5: {
Line 6: Exception x = Server.GetLastError();
Line 7: YAF.Classes.Data.DB.eventlog_create( forum.PageUserID, this, x );
Line 8: YAF.Classes.Utils.CreateMail.CreateLogEmail( x );
Line 9: }


Source File: c:\Websites\mysite\forum\Default.aspx Line: 7

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
ASP.forum_default_aspx.Page_Error(Object sender, EventArgs e) in c:\Websites\bandygoods\forum\Default.aspx:7
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.TemplateControl.OnError(EventArgs e) +2085460
System.Web.UI.Page.HandleError(Exception e) +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7341
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.forum_default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\463217c9\8380a5d\App_Web_geonfmos.2.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64



Any ideas??
wesclyburn
14 years ago
Yeah, I've seen than happen. It happens any time there is an eror before YAF gets a chance to set the forum.UserId, like during Ajax processing or page validation. It's tough when there's an error in the error handler. 🙂 It might help you find it if you remove the page error handler so you can see the exception.

Make sure ValidateRequest is false in the page or master page hosting the forum control. I've turned it off in the sample (iirc), and I can't reproduce the error over here with the sample, so just make sure.

Also Double-check that you're using the rebuilt yaf assemblies and check the version of your AjaxControlToolkit.dll, which is what I ran into initially, and what is probably your problem.
phaedoHD
  • phaedoHD
  • 68% (Friendly)
  • YAF Forumling Topic Starter
14 years ago
Ok, that did it. Once i could see the "real" error it was just that the contentplaceholder id on my master page wasn't the same as on the forum default. So that was easy enough.

However, once I got rid of that error i'm now getting this one when i try loading ~/forum/default.aspx:


Cannot insert the value NULL into column 'UserID', table 'Test_Forum.dbo.yaf_UserGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.
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.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'UserID', table 'Test_Forum.dbo.yaf_UserGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Cannot insert the value NULL into column 'UserID', table 'Test_Forum.dbo.yaf_UserGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +149
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
YAF.Classes.Data.DBAccess.ExecuteNonQuery(SqlCommand cmd, Boolean transaction) in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Data\DBAccess.cs:389
YAF.Classes.Data.DBAccess.ExecuteNonQuery(SqlCommand cmd) in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Data\DBAccess.cs:371
YAF.Classes.Data.DB.user_setrole(Int32 boardID, Object providerUserKey, Object role) in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Data\DB.cs:3140
YAF.Classes.Utils.RoleMembershipHelper.UpdateForumUser(MembershipUser user, Int32 pageBoardID) in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Utils\MembershipHelper.cs:283
YAF.Classes.Base.ForumPage.InitUserAndPage() in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Base\ForumPage.cs:419
YAF.Classes.Base.ForumPage.ForumPage_Init(Object sender, EventArgs e) in D:\Projects\YAF193\YAF.Classes\YAF.Classes.Base\ForumPage.cs:187
System.Web.UI.Control.OnInit(EventArgs e) +99
System.Web.UI.UserControl.OnInit(EventArgs e) +74
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.AddedControl(Control control, Int32 index) +221
System.Web.UI.ControlCollection.Add(Control child) +146
YAF.Forum.Forum_Load(Object sender, EventArgs e) +946
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


Again, any ideas? Thanks for all your help by the way. :-)


phaedoHD
  • phaedoHD
  • 68% (Friendly)
  • YAF Forumling Topic Starter
14 years ago
skilesare
14 years ago
Maybe I'm missing something....I did what you said, but it still says that I only have one user. DO my users have to re register on the forum?

wesclyburn wrote:

The Yaf membership providers are only for backwards compatibility, where a pre-1.9.3 site wants to use the membership system of 2.0, but can't migrate all those existing users from the yaf tables. So, the yaf providers simply get their data from the existing tables.

You can completely ignore the yaf providers for a site that's already using a built-in membership provider and already has its own user store. Yaf just uses the API, and doesn't care what provider is actually doing the work. It creates user records in its own tables when needed. The only required change you have to make is to tell your profile provider it inherits from YafProfileprovider.


wesclyburn
14 years ago
This confused me at first, too. Yaf doesn't import all your users, or insert rows in the yaf_user table just by installing the forum.

Quote:

It creates user records in its own tables when needed.



From what I gather, when a user visits the forum and they're authenticated, yaf then creates the record for the user in its own table. They don't have to register; they just have to visit a page that's part of yaf.


Weird? Sorta, but they probably did this so they can join in the queries instead calling GetUser() to get the username for every single row in a page of posts, among others. It would be slow. This is also why deleting a user using the membership api will not delete the user from yaf (there aren't any hooks for yaf to be notified with), yet using yaf to manage the users will delete the user from both the membership system and yaf.
Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
14 years ago
It's an imperfect system -- but Microsoft didn't choose to add hooks or events for Membership... If they did, it would be a lot simpler.

Instead I'm looking at a code-only solution (no SQL procedures) which MIGHT allow complete membership reliance.
skilesare
14 years ago
That is fantastic. I'll try navigating as an authenticated user.

I know that you can run code when the user signs up(I do...I add them to my application's user table). But I think you're right in saying that there isn't any hook for this...you have to do it on the registration page.
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