Hi, I would like to request the authenticated user and I cannot find in webpages security how to retrieve that information. the code that I´trying to recreate is something like:
if (WebSecurity.IsAuthenticated && WebSecurity.HasUserId)
{
user= WebSecurity.CurrentUserId();
return user;
}
but of course I receive an error... additionally does anyone knows if webmatrix creates an authentication cookie?, if yes does anyone knows how to retrieve that we proceed with formsauthentication.formscookiename, brgds!
Hi Gregori, thank you so much. so it seems that formsauthentication works with webpages.. I´m confused on that topic based on the fact that webmatrix.webdata has no relation with system.web.security where formsauthentication resides... consequently I supposed
using webmatrix security works in a different way... I will try it... brgds
I´m confused on that topic based on the fact that webmatrix.webdata has no relation with system.web.security
That's not a fact. The WebSecurity class, SimpleMembershipProvider, ExtendedMembershipProvider and SimpleRoleProvider all reference System.Web.Security.
Hi Mike, thanks for the clarification... yes you are right... I realized with your comment that simplemembership is implement extendedmembership which extends system.web.security... good to know, thank you so much!.
sebastianh
Member
86 Points
40 Posts
Get Authenticated User...
Feb 24, 2012 07:07 PM|LINK
Hi, I would like to request the authenticated user and I cannot find in webpages security how to retrieve that information. the code that I´trying to recreate is something like:
if (WebSecurity.IsAuthenticated && WebSecurity.HasUserId) { user= WebSecurity.CurrentUserId(); return user; }but of course I receive an error... additionally does anyone knows if webmatrix creates an authentication cookie?, if yes does anyone knows how to retrieve that we proceed with formsauthentication.formscookiename, brgds!
GmGregori
Contributor
5470 Points
737 Posts
Re: Get Authenticated User...
Feb 24, 2012 11:03 PM|LINK
If you want to retrieve user informations you should use the following WebSecurity properties:
For more informations on WebSecurity see at WebSecurity Class.
On cookies and formsauthentication maybe these links could help you:
Using FormsAuthentication in ASP.NET WebPages
Using FormsAuthentication
sebastianh
Member
86 Points
40 Posts
Re: Get Authenticated User...
Feb 25, 2012 01:59 AM|LINK
Hi Gregori, thank you so much. so it seems that formsauthentication works with webpages.. I´m confused on that topic based on the fact that webmatrix.webdata has no relation with system.web.security where formsauthentication resides... consequently I supposed using webmatrix security works in a different way... I will try it... brgds
Mikesdotnett...
All-Star
154901 Points
19864 Posts
Moderator
MVP
Re: Get Authenticated User...
Feb 25, 2012 06:45 AM|LINK
That's not a fact. The WebSecurity class, SimpleMembershipProvider, ExtendedMembershipProvider and SimpleRoleProvider all reference System.Web.Security.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
sebastianh
Member
86 Points
40 Posts
Re: Get Authenticated User...
Feb 25, 2012 07:13 AM|LINK
Hi Mike, thanks for the clarification... yes you are right... I realized with your comment that simplemembership is implement extendedmembership which extends system.web.security... good to know, thank you so much!.
public class SimpleMembershipProvider :
WebMatrix.WebData.ExtendedMembershipProvider
Member of
WebMatrix.WebData