将登录代码放入sitecore函数
请有人帮帮我。我想在我的网站上创建登录页面,这是我的查看代码将登录代码放入sitecore函数,sitecore,Sitecore,请有人帮帮我。我想在我的网站上创建登录页面,这是我的查看代码 <asp:TextBox CssClass="input-block-level" placeholder="Email address" runat="server" ID="txtUser"/> <asp:TextBox runat="server" ID="txtPass" TextMode="Password" CssClass="input-block-level" placehold
<asp:TextBox CssClass="input-block-level" placeholder="Email address" runat="server" ID="txtUser"/>
<asp:TextBox runat="server" ID="txtPass" TextMode="Password" CssClass="input-block-level" placeholder="password"/>
<asp:Button runat="server" ID="btnlogin" CssClass="btn btn-large btn-primary" Text="Sign in" OnClick="btnlogin_Click"/>
任何建议都将不胜感激。谢谢 您需要在Sitecore中已有用户,这是用于登录的代码,如果您登录,则返回true,否则返回false
/// <summary>
/// Logins the specified username.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <returns><c>true</c> if user login is ok; otherwise, <c>false</c></returns>
public static bool Login(string username, string password)
{
username = string.Format(@"{0}\{1}", "yourDomain", username);
try
{
if (Sitecore.Security.Authentication.AuthenticationManager.Login(username, password))
{
return true;
}
}
catch (System.Security.Authentication.AuthenticationException exception)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+" login error","");
}
return false;
}
//
///使用指定的用户名登录。
///
///用户名。
///密码。
///如果用户登录正常,则为true;否则,错误
公共静态bool登录(字符串用户名、字符串密码)
{
username=string.Format(@“{0}\{1}”,“yourDomain”,username);
尝试
{
if(Sitecore.Security.Authentication.AuthenticationManager.Login(用户名、密码))
{
返回true;
}
}
捕获(System.Security.Authentication.AuthenticationException异常)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+“登录错误”,“异常”);
}
返回false;
}
您需要在Sitecore中已有用户,这是用于登录的代码,如果您登录,则返回true;否则返回false
/// <summary>
/// Logins the specified username.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <returns><c>true</c> if user login is ok; otherwise, <c>false</c></returns>
public static bool Login(string username, string password)
{
username = string.Format(@"{0}\{1}", "yourDomain", username);
try
{
if (Sitecore.Security.Authentication.AuthenticationManager.Login(username, password))
{
return true;
}
}
catch (System.Security.Authentication.AuthenticationException exception)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+" login error","");
}
return false;
}
//
///使用指定的用户名登录。
///
///用户名。
///密码。
///如果用户登录正常,则为true;否则,错误
公共静态bool登录(字符串用户名、字符串密码)
{
username=string.Format(@“{0}\{1}”,“yourDomain”,username);
尝试
{
if(Sitecore.Security.Authentication.AuthenticationManager.Login(用户名、密码))
{
返回true;
}
}
捕获(System.Security.Authentication.AuthenticationException异常)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+“登录错误”,“异常”);
}
返回false;
}
您需要在Sitecore中已有用户,这是用于登录的代码,如果您登录,则返回true;否则返回false
/// <summary>
/// Logins the specified username.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <returns><c>true</c> if user login is ok; otherwise, <c>false</c></returns>
public static bool Login(string username, string password)
{
username = string.Format(@"{0}\{1}", "yourDomain", username);
try
{
if (Sitecore.Security.Authentication.AuthenticationManager.Login(username, password))
{
return true;
}
}
catch (System.Security.Authentication.AuthenticationException exception)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+" login error","");
}
return false;
}
//
///使用指定的用户名登录。
///
///用户名。
///密码。
///如果用户登录正常,则为true;否则,错误
公共静态bool登录(字符串用户名、字符串密码)
{
username=string.Format(@“{0}\{1}”,“yourDomain”,username);
尝试
{
if(Sitecore.Security.Authentication.AuthenticationManager.Login(用户名、密码))
{
返回true;
}
}
捕获(System.Security.Authentication.AuthenticationException异常)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+“登录错误”,“异常”);
}
返回false;
}
您需要在Sitecore中已有用户,这是用于登录的代码,如果您登录,则返回true;否则返回false
/// <summary>
/// Logins the specified username.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <returns><c>true</c> if user login is ok; otherwise, <c>false</c></returns>
public static bool Login(string username, string password)
{
username = string.Format(@"{0}\{1}", "yourDomain", username);
try
{
if (Sitecore.Security.Authentication.AuthenticationManager.Login(username, password))
{
return true;
}
}
catch (System.Security.Authentication.AuthenticationException exception)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+" login error","");
}
return false;
}
//
///使用指定的用户名登录。
///
///用户名。
///密码。
///如果用户登录正常,则为true;否则,错误
公共静态bool登录(字符串用户名、字符串密码)
{
username=string.Format(@“{0}\{1}”,“yourDomain”,username);
尝试
{
if(Sitecore.Security.Authentication.AuthenticationManager.Login(用户名、密码))
{
返回true;
}
}
捕获(System.Security.Authentication.AuthenticationException异常)
{
Sitecore.Diagnostics.Log.Error(exception.StackTrace+“登录错误”,“异常”);
}
返回false;
}