Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shashikumar 13 posts 33 karma points
    Aug 31, 2009 @ 14:48
    Shashikumar
    0

    .Net user control (Macro) Login page redirecting to login page itself

    Hi

    I am using umbraco 4.0, I have to deploy my web application project in umbraco 4. i created a master template in umbraco and created macros for my .net usercontrols. am using <form runat="server" ></form> in the master template. Now my problem is, when i try to login using the login crentials, the login page redirects again to the login page itself. Ex: http://www.xyz.com/login.aspx? I don't know what's the problem is. can any one help with this issue? My login template is shown below:

    <%@ Master Language="C#" MasterPageFile="/masterpages/MasterTemplate.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="MasterTemplateContentPlaceHolder" runat="server">
         <h3 title="<umbraco:Item runat='server' field='PageHeader'/>"><umbraco:Item runat="server" field="PageHeader"/></h3>
    <umbraco:Item runat="server" field="bodyText"/>

    <umbraco:Macro runat="server" Alias="NewLogin" macroAlias="NewLogin"></umbraco:Macro>

    <umbraco:Item runat="server" field="bodyFooter"/>
    </asp:Content>

    Advance thanks,

    Shashikumar
     

  • Ricky Beard 61 posts 116 karma points
    Aug 31, 2009 @ 15:07
    Ricky Beard
    0

    If you are using the Login server control, first make sure to set the DestinationPageURL property to the desired url. However, for some reason, this doesn't always seem to work.

    If it doesn't, you can try something like this in the code-behind of your user control:

    Protected Sub <controlname>_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs)
    Response.Redirect(<LoginControlName>.DestinationPageUrl)
    End Sub
  • Shashikumar 13 posts 33 karma points
    Sep 10, 2009 @ 13:47
    Shashikumar
    0

    Hi,

    I am not using asp.net login control, I am getting two textbox values and checking the value in database and redirecting to the destination page using C# code. This works fine in IE but not in firefox.

     

    Thanks.

  • Ricky Beard 61 posts 116 karma points
    Sep 15, 2009 @ 17:07
    Ricky Beard
    0

    Are you sure the page is posting back in Firefox? Does the authentication still occur in FIrefox despite no redirect?

    Also (and this is a long shot), make sure your form tag is not outside of your body tag. That is known to kill postbacks in Firefox.

  • Shashikumar 13 posts 33 karma points
    Sep 16, 2009 @ 14:52
    Shashikumar
    0

    Post back occurs in firefox but not redirecting to the destination url. I am using master template, in that placing form tag inside of body tag. Master template will look like this.

     

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head id="PageHead" runat="server">

        <meta http-equiv="Page-Exit" content="progid:DXImageTransform.Microsoft.Fade(duration=0.500)" />
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

        <meta http-equiv="Content-Language" content="en" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="Keywords" content="<umbraco:Item runat='server' field='keywords'/>" />
        <meta name="Description"  content="<umbraco:Item runat='server' field='Description'/>" />
        <meta name="document-type" content="Public" />
        <meta name="document-rating" content="General" />
        <meta name="owner" content="" />
        <meta name="author" content="Richard Thurbin" />
        <meta name="copyright" content="" />

     </title>
        
      </head>

    <body>

     <form id="form1" runat="server">
            <div id="content-wrapper" class="cheight">
       
            <div class="content">
           
                <div id="frag_left">
     <span id="lblHeaderText" style="background-color: #4682B4;height:32px;padding-left:27px;font-weight:bold;font-size:24pt;">Alive</span>
    <div style="background-color: white; height:2px;">&nbsp;</div>

                     <umbraco:Macro runat="server" Alias="LeftPane" macroAlias="LeftPane"></umbraco:Macro>                  

                </div>
               
                <div id="frag_right">
               
                    <div id="menu_bar_top" style="background-color: #4682B4;"> 
                 
                       <umbraco:Macro runat="server" Alias="HeaderText" macroAlias="HeaderText"></umbraco:Macro>

                    </div>
                    <div style="height: 25px; background-color: white;">
                        <span class="lblHeader">Association</span>
                    </div>
                    <div id="menu_bar">

                        <umbraco:Macro runat="server" Alias="Menu" macroAlias="Menu"></umbraco:Macro>    

               </div>
                    <div id="mainContent">

                        <asp:ContentPlaceHolder ID="MasterTemplateContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>

                        (User control will render in this area)

                    </div>
                </div>      
                             
                <div id="footer_space"></div>           
                <div class="footer_bar">
               <umbraco:Macro runat="server" Alias="Footer" macroAlias="Footer"></umbraco:Macro>
                </div>                       
            </div>
        </div>
    </form>
        </body>

    </html>
    </asp:content>

  • Ricky Beard 61 posts 116 karma points
    Sep 16, 2009 @ 16:42
    Ricky Beard
    0

    I have not been able to replicate this problem. I used the markup you posted above and tried both RedirectFromLoginPage and Response.Redirect in a user control successfully in both IE and Firefox.

    Can you post your code behind from your user control?

  • Shashikumar 13 posts 33 karma points
    Sep 17, 2009 @ 13:27
    Shashikumar
    0
    <%@ Master Language="C#" MasterPageFile="/masterpages/MasterTemplate.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="MasterTemplateContentPlaceHolder" runat="server">
         <h3 title="<umbraco:Item runat='server' field='PageHeader'/>"><umbraco:Item runat="server" field="PageHeader"/></h3>
    <umbraco:Item runat="server" field="bodyText"/>
    <form id="loginform" action="#">
    <umbraco:Macro runat="server" Alias="NewLogin" macroAlias="NewLogin"></umbraco:Macro>
    </form>
    <umbraco:Item runat="server" field="bodyFooter"/>
    </asp:Content>

    Hi Ricky, I have created a template for the user control as above (as you can see, "<umbraco:Macro runat="server" Alias="NewLogin" macroAlias="NewLogin"></umbraco:Macro>")

    My user control code is look like this,

     

    protected void btnLogin_Click(object sender, EventArgs e)

    {

     

    if (Page.IsValid)

    {

     

    using (DataTable dtValidate = methods.validateUser(txtUsername.Text.Trim(), txtPassword.Text.Trim()))

    {

     

    if (dtValidate.Rows.Count > 0)

    {

     

    if (Convert.ToBoolean(dtValidate.Rows[0]["IsActive"]))

    {

     

    string ID = dtValidate.Rows[0]["UserId"].ToString();

     

    string pwd = dtValidate.Rows[0]["Password"].ToString();

     

    if (pwd.GetHashCode() == txtPassword.Text.GetHashCode())

    {

     

    int RoleId = getRoleId(ID);

     

    if (RoleId != 0)

     

    Session.UserType = (UserType)getRoleId(ID);

     

    Session.UserName = txtUsername.Text;

     

    Session.UserID = ID;

     

    Response.Redirect(

    "Home.aspx", false); //Here I am redirection to the destination page after authenticating user credentials.

    }

     

    else

    {

    lblError.Text =

    "Invalid Login Credentials.";

    }

    }

     

    else

    {

    lblError.Text =

    "Account is not Activated.";

    }

    }

     

    else

    {

    lblError.Text =

    "Invalid Login Credentials.";

    }

    }

    }

    }

     

    Thanks.

  • Ricky Beard 61 posts 116 karma points
    Sep 17, 2009 @ 21:34
    Ricky Beard
    0

    I still have not been able to replicate this problem. However, I did some research and found one possibility pertaining to Smart Navigation.

    Also, have you tried using Server.Transfer to see if it makes any difference?

  • Shashikumar 13 posts 33 karma points
    Sep 18, 2009 @ 09:06
    Shashikumar
    0

    I tried with server.transfer but no use. In firefox the login page stays in login page itself. Whether i am wrong in creating the macros and master template? But it works fine in all IE browsers except firefox.

  • Ricky Beard 61 posts 116 karma points
    Sep 18, 2009 @ 16:04
    Ricky Beard
    0

    Is this on a dev machine or is there a live page we can look at?

  • Shashikumar 13 posts 33 karma points
    Sep 22, 2009 @ 08:07
    Shashikumar
    0

    Live page. you can see at www.synwa.com in firefox the login page postback but stays in the login page itself

  • Ricky Beard 61 posts 116 karma points
    Sep 22, 2009 @ 15:28
    Ricky Beard
    0

    You have nested form tags which is known to cause postback problems.

    You have this immediately after your <body> tag:

    <form method="post" action="/login.aspx?" id="aspnetForm">

    Then, you have this inside of your user control immediately before your login form:

    <form id="loginform" action="#"> 

    This nested form has no "runat" attribute and its action is set to "#" which will anchor it to the current page. This is the form that Firefox is submitting instead of the outer form and therefore your postback is never occuring.

  • Shashikumar 13 posts 33 karma points
    Sep 23, 2009 @ 07:11
    Shashikumar
    0

    Hi Ricky,

    I removed the <form id="loginform" action="#">. In such case, the same thing happening in IE and firefox. That is, if I remove that form tag the login page stays in login page itself in IE.

  • Ricky Beard 61 posts 116 karma points
    Sep 23, 2009 @ 17:08
    Ricky Beard
    0

    Alright, I was finally able to replicate this problem and traced it to this line of markup being generated by .NET at the bottom of the outer form.

    <input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="0mxVR_N1gAvsVN3_2d_L0A2" />

    This line is affected by the PostBackUrl property on the login button.

    When I set the PostBackUrl property (even to the current page), it kills the PostBack.

    Did you set the PostBackUrl property on your login button? If so, remove it as well as the embedded form.

  • Shashikumar 13 posts 33 karma points
    Sep 24, 2009 @ 07:43
    Shashikumar
    0

    Hi Ricky,

    Thanks a lot. Finally the problem has solved. I have used to give postbackurl property in "Forgot password" link button, this kills the postback in the login page. I have changed to hyperlink for forgot password and used navigate url property; now its working fine. I am afraid that postback url property doesn't support in umbraco.

    Thanks for your help.

  • Ricky Beard 61 posts 116 karma points
    Sep 25, 2009 @ 03:03
    Ricky Beard
    0

    You are very welcome. I'm glad we got it figured out.

  • Max 144 posts 166 karma points
    Nov 14, 2011 @ 08:24
    Max
    0

    i have a registration page using a custom .net user control i tried to use the submit button as ,net button control after the registration is over i try to use Response.Redirect() to another page its not working in Umbraco ?? any idea why

Please Sign in or register to post replies

Write your reply to:

Draft