Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi to all,I have a problem with members authentication.
After I logged in with a member, the session never expire.
This is what I set in the web.config:
***********************************************<authentication mode="Forms"> <forms name="intranetAuth" loginUrl="/it" protection="All" path="/" timeout="10" /></authentication>***********************************************
This is the .cshtml file with the login form:
****************************************************************************************************************************
@using System.Web@using System.Web.Configuration@using System.Web.Security@using System.Web.UI;
@helper LoginForm(){ <div id="masterLogin"> <form name="frmMasterLogin" method="post" action=""> <div class="content"> <label for="masterUsername" /><input type="text" id="masterUsername" name="masterUsername" value="username" class="campo" /> <label for="masterPassword" /><input type="password" id="masterPassword" name="masterPassword" value="password" class="campo" /> <input type="submit" id="btnMasterLogin" name="btnMasterLogin" value="Accedi" class="submit" />
</div> </form> </div>}
I forgot something?Can anyone help me?Thank you in advanceAdriano
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Problem with Members authentication timeout
Hi to all,
I have a problem with members authentication.
After I logged in with a member, the session never expire.
This is what I set in the web.config:
***********************************************
<authentication mode="Forms">
<forms name="intranetAuth"
loginUrl="/it"
protection="All"
path="/"
timeout="10" />
</authentication>
***********************************************
This is the .cshtml file with the login form:
****************************************************************************************************************************
@using System.Web
@using System.Web.Configuration
@using System.Web.Security
@using System.Web.UI;
@helper LoginForm()
{
<div id="masterLogin">
<form name="frmMasterLogin" method="post" action="">
<div class="content">
<label for="masterUsername" /><input type="text" id="masterUsername" name="masterUsername" value="username" class="campo" />
<label for="masterPassword" /><input type="password" id="masterPassword" name="masterPassword" value="password" class="campo" />
<input type="submit" id="btnMasterLogin" name="btnMasterLogin" value="Accedi" class="submit" />
</div>
@{</form>
</div>
}
var request = HttpContext.Current.Request;
var isSubmitLogin = (request.HttpMethod == "POST" && request.Form["btnMasterLogin"] == "Accedi");
var isSubmitLogout = (request.HttpMethod == "POST" && request.Form["btnMasterLogout"] == "Disconnetti");
var currentMember = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
if (currentMember != null)
{
if (!isSubmitLogout)
{
var currentMemberType = "/" + @currentMember.ContentType.Text.ToLower().Replace(" ", "-");
//Response.Redirect(@currentMemberType);
<input type="submit" id="btnMasterLogout" name="btnMasterLogout" value="Disconnetti" class="submit" />
}
else
{
umbraco.cms.businesslogic.member.Member.ClearMemberFromClient(@currentMember.Id);
FormsAuthentication.SignOut();
Response.Redirect("/?logout=true");
}
}
else
{
if (!isSubmitLogin)
{
@LoginForm()
}
else
{
string username=request.Form["masterUsername"];
string password=request.Form["masterPassword"];
if (Membership.ValidateUser(username, password))
{
FormsAuthentication.RedirectFromLoginPage(username, true);
}
else
{
<div class="errorLogin">Username o Password errata (@username)</div>
@LoginForm()
}
}
}
}
****************************************************************************************************************************
I forgot something?
Can anyone help me?
Thank you in advance
Adriano
is working on a reply...