.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:
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
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.
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.
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?
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>")
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.
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.
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.
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.
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
.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
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:
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.
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.
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;"> </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>
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?
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,
Thanks.
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?
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.
Is this on a dev machine or is there a live page we can look at?
Live page. you can see at www.synwa.com in firefox the login page postback but stays in the login page itself
You have nested form tags which is known to cause postback problems.
You have this immediately after your <body> tag:
Then, you have this inside of your user control immediately before your login form:
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.
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.
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.
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.
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.
You are very welcome. I'm glad we got it figured out.
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
is working on a reply...