FormsAuthentication.RedirectFromLoginPage not working in MojoPortal..?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
8/27/2013 5:08:00 AM
Gravatar
Total Posts 4

FormsAuthentication.RedirectFromLoginPage not working in MojoPortal..?

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.

You must sign in to post in the forums. This thread is closed to new posts.