Hi,
We have implemented ASP Membership in Mojoportal and faced some critical issues.
We have used a Mojoportal Database (MojoDB1) and ASP Membership Database (database1) created for our project. We used Mojoportal Database only for Content Managing i.e.) only for admin use and all our Site User Details are maintained in a separate database (database1). We didn’t use MojoMembershipProvider for database1, Instead of MojoMembershipProvider we used SqlMembershipProvider and added SqlMembershipProvider inside the membership section as shown below.
<membership defaultProvider="mojoMembershipProvider">
<providers>
<clear/>
<add name="CustomMemberShipProvider1"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="Connectionstringname1"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="10"
minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
<add name="mojoMembershipProvider" type="mojoPortal.Web.mojoMembershipProvider"/>
</providers>
</membership>
On the Above membership section we added mojoMembershipProvider as defaultProvider .
In our site we used ASP Login, CreateUserWizard, PasswordRecovery, LoginName and LoginStatus Controls. By implementing the above ASP Controls, we met some issues.
On logging in, we used to authenticate the user as below:
Login.ascx:
<portal:mojoPanel ID="mp1" runat="server" ArtisteerCssClass="login-module" RenderArtisteerBlockContentDivs="false">
<asp:Panel ID="pnlLogIn" runat="server" Visible="true">
<asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate" LoginButtonText="Login" RememberMeText="Remember Me" UserNameLabelText="Email:" UserNameRequiredErrorMessage="Email address is required." >
</asp:Login>
</asp:Panel>
<asp:Panel ID="pnlLogOut" runat="server" Visible="false">
<asp:LoginName ID="LoginName1" runat="server"></asp:LoginName>
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="/" OnLoggedOut="LoginStatus1_LoggedOut" LoginText="Login" LogoutText="LogOut" LogoutAction="Redirect"></asp:LoginStatus>
</asp:Panel>
</portal:mojoPanel>
Login.ascx.cs:
if (Membership.Providers["CustomMemberShipProvider1"].ValidateUser(Login1.UserName, Login1.Password) == true)
{
string strUserName = Membership.Providers["CustomMemberShipProvider1"].GetUserNameByEmail(Login1.UserName); Session["user"] = strUserName;
//it’s not redirecting to the page mentioned in the web.config
FormsAuthentication.RedirectFromLoginPage (Login1.UserName, true);
//also we tried setting authentication cookie by this way, but it failed and if we set
//this authentication cookie, Response.Redirect and SiteUtils.RedirectToUrl are not
//working, it just throws an error as thread was being aborted
FormsAuthentication.SetAuthCookie (strUserName, true);
}
Web.config for Authentication Section:
<authentication mode="Forms">
<forms name=".mojochangeme" protection="All" timeout="20160" path="/" cookieless="UseCookies" defaultUrl="HomePage.aspx" loginUrl="Login.aspx" />
</authentication>
Our Major problem is, FormsAuthentication not working in MojoPortal, so that ASP LoginName and LoginStatus Controls are not working or it cannot retrieve current user details.
FYI, We are using two different skin for Login and HomePage.
Why it’s not working in Mojoportal..? Are we missing anything to redirect a page?
Is there any way to make “FormsAuthentication. RedirectFromLoginPage” work in Mojoportal?
Kindly please advise me on this issue.
Thanks in advance.