YAFLogo

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
11 months ago
I've been using the YAF forum on a sub domain on my site for about 19 years now with other parts of the site sharing the same YAF login. Previously this was nice and easy, I could specify the membership provider in the web config and it all worked seamlessly. Then this happened...

UPGRADE NOTICE

Be aware that the Old Asp.NET Membership/Role/Profile Providers are no longer been used. It will be automatically upgraded to the new ASP.NET Identity Providers. If you are using a custom Membership Provider, an manual upgrade is necessary!

Since this upgrade, I've been struggling to get things to work properly. In my lack of understanding of the Identity Provider I have made changes that looked at the old yaf_prov_Membership table and things appeared to be working again until new people register and obviously they're not in this table.

I followed a tutorial about setting up Identity Provider and when I tried to log in, it then tried to create it's own AspNetUsers table and I can't figure out how to point it to the yaf tables instead. I have looked at various threads on this forum for help, but I can't seem to find anything that is reliably new.

Can anyone explain to me or even better provide a little example, of how to use the yaf Identity provider in a different project, pointing to the same database?

 

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
11 months ago

Can anyone explain to me or even better provide a little example, of how to use the yaf Identity provider in a different project, pointing to the same database?

 

Originally Posted by: pre67vw 

If i understand correctly you only need the login. All info on how to log in the user can be found in the source on the login page 

https://github.com/YAFNET/YAFNET/blob/29de30d4336d5ba8735ba31c32e33fa7c45dc0c2/yafsrc/YetAnotherForum.NET/Pages/Account/Login.ascx.cs#L139 

But you do know that you can run yaf inside your application, then you dont need an extra login you can just use the yaf login like in the YAF SampleApplication

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
11 months ago
The problem is that my 24 year old site is built in VB, so I don't think I can run yaf inside it. When I try and use the code from the login page I get unstuck at this part:

this.Get()<IAspNetUsersHelper> saying that I can't call stuff from an interface. Maybe it's time to rewrite the site in c# but that's a huge job.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
11 months ago

The problem is that my 24 year old site is built in VB, so I don't think I can run yaf inside it.

Originally Posted by: pre67vw 

Yes it is technically possible to mix vb with c# in your app.

When I try and use the code from the login page I get unstuck at this part:

 saying that I can't call stuff from an interface. 

Originally Posted by: pre67vw 

Change it to 

BoardContext.Current.Get<IAspNetUsersHelper>().ValidateUser(this.UserName.Text.Trim());

Maybe it's time to rewrite the site in c# but that's a huge job.

Originally Posted by: pre67vw 

You can do that online with converters it only takes a few minutes.

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
11 months ago
Just downloaded the sample web application, that would be so much better than what I currently have - much more integrated for the user. Thanks for letting me know about this, I never knew it existed. 👍
pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
10 months ago
OK, I have completely rebuilt my site using the Sample Application as a base and added my own stuff into it. All the login stuff seems much better now, much more integrated. 👍

One problem I can't see how to fix is that my search no longer works. I can see in the browser that it's calling an API page - but that page responds with:

SearchResults:

TotalRecords: 0

in the Json (the payload is) :

{

  "ForumId": 0,

  "PageSize": "5",

  "Page": 0,

  "SearchTerm": "(+karmann)"

}

I can't see any kind of search query hitting the database though. I have tried hitting the Re-Index Search button a few times, that didn't solve it.

The second question I have is that I would like to enable webp images on the forum. I have added the extension into the allowed file types and it's now possible to upload the images - but they are displayed as attachments not as thumbnails. Is it possible to make them show as thumbnails in the settings somewhere?

Many thanks!

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
10 months ago

I can't see any kind of search query hitting the database though. I have tried hitting the Re-Index Search button a few times, that didn't solve it.

Check the event log is the search database was created, or if there are any errors.

The second question I have is that I would like to enable webp images on the forum. I have added the extension into the allowed file types and it's now possible to upload the images - but they are displayed as attachments not as thumbnails. Is it possible to make them show as thumbnails in the settings somewhere?

The image format is not supported, so there is no setting to enable it. But i can add it in the next release 3.1.15.

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
10 months ago

Check the event log is the search database was created, or if there are any errors.

Originally Posted by: tha_watcha 

I don't see any errors. I do see a bunch of files in App_Data/search_index directory with recent datestamps on them. This folder wasn't in the Sample Application, so I created it. 

The image format is not supported, so there is no setting to enable it. But i can add it in the next release 3.1.15.

Originally Posted by: tha_watcha 

That would be fantastic, thanks!!

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
10 months ago

I don't see any errors. I do see a bunch of files in App_Data/search_index directory with recent datestamps on them. This folder wasn't in the Sample Application, so I created it. 

That is correct in the folder search_index is the search db stored. I checked your site and it works if i search for your user name like yourdomain.com//forum/Search?postedby=pre67vw

however in the members list there is no such user as "karmann" so of course it finds nothing.

Also there seems to be an issue with the lightbox.js which seems to block the search loading screen.

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
10 months ago
But I was doing a general search, not a username search. Has the search changed now to only search for usernames?
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
10 months ago

But I was doing a general search, not a username search. Has the search changed now to only search for usernames?

Originally Posted by: pre67vw 

Sorry you're right, is misread the code. But does the the search term actually exists somewhere in the forum? i tried other search terms and it did show correct results.

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
10 months ago

But I was doing a general search, not a username search. Has the search changed now to only search for usernames?

Originally Posted by: tha_watcha 

Sorry you're right, is misread the code. But does the the search term actually exists somewhere in the forum? i tried other search terms and it did show correct results.

Originally Posted by: pre67vw 

I think I may have found the source of my problem, but I don't know how to fix it. My Task Manager is empty, so presumably when I hit the re-index, nothing is actually happening. Do you have any idea why it might be empty? Maybe a data issue, or permissions? 

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
10 months ago
I dont know why the task manager is empty. But you can see if the index task was executed if you enable under Host > Host Settings >  Allow log Application Info 

But as i wrote before i can after testing the search for posts or topic titles works in your forum.

pre67vw
  • pre67vw
  • 64.4% (Friendly)
  • YAF Camper Topic Starter
10 months ago
OK, all sorted. 👍 I had added a Session_Start into the global.asax, which must interfere with the task manager. As soon as I removed this function, the task manager runs and my forum has now been re-indexed and the search works...  Thanks tha_watcha for all your help! 😁