ASP.NET Membership Gets Anonymous UserId

I have an existing project I'm working on that uses .net membership. We want to expand the project to anonymous users, but we seem to fall into the trap because we use the UserId tables of aspnet_Users as a foreign key in many of our database tables.

The next call returns null because there is no entry in the aspnet_Membership table for anonymous users

Membership.Provider.GetUser(Request.AnonymousID, false);

Is there a way to get the anonymous userId via the standard API? or do I need to write an extension that can do this?

+2
source share
1 answer

, . - , . aspnet. , , .

, , allowanonymous true .

. http://www.odetocode.com/Articles/440.aspx

+2

Source: https://habr.com/ru/post/1721005/


All Articles