c# - ASP Net - using LoginView without Membership -


well,

i want know how can use loginview asp, when use own method of authentication, in topic.

here follow loginview mark:

<asp:loginview runat="server" viewstatemode="disabled">      <anonymoustemplate>        <ul class="nav navbar-nav navbar-right">             <li><a runat="server" href="~/account/register">register</a></li>             <li><a runat="server" href="~/account/login">log in</a></li>       </ul>    </anonymoustemplate>     <loggedintemplate>         <ul class="nav navbar-nav navbar-right">             <li>                 <a runat="server" href="~/account/manage" title="manage account">hello, <%: context.user.identity.getusername()  %> !</a>              </li>              <li>                 <asp:loginstatus runat="server" logoutaction="redirect" logouttext="log   off" logoutpageurl="~/" onloggingout="unnamed_loggingout" />              </li>        </ul>      </loggedintemplate> </asp:loginview> 

this authentication:

 //this button's event    protected void login(object sender, eventargs e)  {     try {           // method user properties, case exists             usuario user = dusuario.logar(email.text, password.text);            if (user != null)           {              session["user"] = user;              response.redirect("~/default.aspx");            }else{         //rest of code...     } 

my class usuario, user's data.

public class usuario {     public int id { get; set; }     public string login { get; set; }     public string nome { get; set; }       public string senha { get; set; }     public string email { get; set; }     public datetime ultimoacesso { get; set; }     public mes mesatual { get; set; }  } 

my code working using session log in , redirect login page when user not logged in, can access user's data... don't know, , didn't find how use listview in case.

following other topic, tried use follow method after user logged in informations, did't work:

formsauthentication.setauthcookie(user.nome, true); 

somebody ? '.'

formsauthentication.setauthcookie(user.nome, true); 

should work (i use lot). find have redirect home page cookie gets loaded , page authenticates.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -