.NET Framework user processing mechanism (Forms)

xiaoxiao2021-03-06  46

1. Declare in Web.config:

Protection = "all" timeout = "30">

II. Normally enter the page:

CONTEXT.USER = User;

Formsauthentication.sertauthCookie (TBemail.Text, True);

Where User is a user object that has UserID, username, emaildress, and so on.

Third. Page conversion:

First join in Global.asax:

Protected Void Application_AuthenticateRequest (Object Sender, Eventargs E)

{

IF (request.isauthenticated == true)

{

Context.user = new dong.webmodules.accounts.business.dongprincipal (context.user.Identity.Name);

}

}

Then take the value in another page and other operations:

DONG.WEBModules.accounts.business.user currentuser =

New dong.webmodules.accounts.business.user ((Dong.webmodules.accounts.business.dongprincipal) Context.user);

TBUSERNAME.TEXT = CurrentUser.userName;

TBemail.Text = Currentuser.emailaddress;

转载请注明原文地址:https://www.9cbs.com/read-89431.html

New Post(0)