I have a problem with refreshing login membership page on the master page.

Last post 09-09-2008 4:39 PM by xxxd. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 09-07-2008 4:06 AM

    • macupryk
    • Top 25 Contributor
    • Joined on 08-04-2008
    • Wannabe Slacker
    • Points 862

    I have a problem with refreshing login membership page on the master page.

     If you goto omegalove.com and log in with username macupryk and password cupryk
    and press login nothing happens. But if u press refresh it will login.
    I need the login to take the page to profile.aspx and I don't want to have this issue with refreshing the page.
    See master page attached snippet.
    ---------------------------

    <script type="text/javascript">
    // These functions here are mearly for a "WOW" factor. They have nothing
    // to do with ASP.NET AJAX. The ASP.NET AJAX functionality is below.
     
    var hideTimerID = 0;
     
    //function showLogin() {
    //	clearTimeout(hideTimerID);
     
    //	$get("login-link").style.visibility = "hidden";
     
    //	$get("login-panel").style.visibility = "visible";
     
    //	$get("userName").focus();
     
    //	// Hide the login panel after 30 seconds.
    //	hideTimerID = setTimeout(hideLogin, 30000);
    //}
     
    function hideLogin() {
    	$get("login-link").style.visibility = "visible";
     
    	$get("login-panel").style.visibility = "hidden";
     
    	// Blank out the username and password for security reasons.
    	$get("userName").value = "";
     
    	$get("password").value = "";
    }
     
    function checkForEnter(e) {
    	if (!e) e = window.event;
     
    	if (e && e.keyCode == 13) {
    		loginButton_Click();
    	}
    }
    	</script>
     
    <script type="text/javascript">
    // Now we are in the actual ASP.NET AJAX implimentation. These are some very
    // simple JavaScript methods that will tap into the ASP.NET AJAX Framework.
     
    function errorCallback(error) {
    	alert(error.get_message());
    }
     
    function loginCallback(loggedIn) {
    	hideLogin();
     
    	if (loggedIn == false) {
    		alert("The username and password you supplied is invalid.");
    	}
    }
     
    function loginButton_Click() {
        Sys.Services.AuthenticationService.login($get("userName").value, 
    	$get("password").value,	$get("rememberMe").checked, null, location.href, loginCallback, errorCallback);
    }
     
    function logoutButton_Click() {
    	Sys.Services.AuthenticationService.logout(location.href, null, errorCallback);
    }
    </script>
     
    </head>
     
    <body>
         <ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager1" />
     
         <form runat="server">
       
        
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
        
        <tr>
        <td colspan="3" class="pagetop">
            <table width="100%" border="0">
            <tr>
            
            <td style="height: 17px">
                 <asp:HyperLink ID="HyperLink1" Runat="server" ImageUrl="~/images/omegalovelogo.jpg" NavigateUrl="~/default.aspx"></asp:HyperLink>
            </td>
            
            <td valign="bottom" align="right" style="height: 17px"> 
           
     
            <div id="loginbox">
           <asp:LoginView ID="LoginView1" runat="server">
    				<AnonymousTemplate>
    					<div id="login-panel" style="visibility: visible;">
    						
    						<fieldset onkeydown="checkForEnter();" style="border-style: none;">
    							<label>
    								User Name:<input type="text" id="userName" /></label>
    							<label>
    								Password:<input type="password" id="password" /></label>
    							<asp:ImageButton ImageAlign="Middle" ID="Submit" runat="server" AlternateText="Login"
                                     CommandName="Login" ImageUrl="~/Images/login_btn.jpg"
                                     onClientclick="BLOCKED SCRIPTsetTimeout(loginButton_Click, 0); return false;"/>	
                                <label class="checkbox" for="rememberMe">
    								<input type="checkbox" id="rememberMe" checked="checked" />Remember Me</label>				
                                &nbsp;|&nbsp;<asp:HyperLink ID="lnkPasswordRecovery" runat="server" NavigateUrl="~/PasswordRecovery.aspx">Forgot password?</asp:HyperLink>
                                
    						</fieldset>
    					</div>
    				</AnonymousTemplate>
    				<LoggedInTemplate>
    				      <div id="welcomebox">
                      <asp:LoginName ID="LoginName1" runat="server" FormatString="Hello	{0}" /><br />
                      <small>
                      <%--<asp:HyperLink ID="lnkProfile" runat="server" Text="Edit Profile" NavigateUrl="~/EditProfile.aspx" /><br /> 
                      --%><asp:LoginStatus ID="LoginStatus1" Runat="server" />
                      </small>
                   </div>
    			</LoggedInTemplate>
    			</asp:LoginView>
            </div>         
       
            </td>
            
            </tr>
            
            </table>        
            
            <div id="nav_header">
                <ul>
                    <asp:Repeater ID="TopMenuRepeater" runat="server" DataSourceID="SiteMapDataSource"
                        EnableTheming="True">
                        <ItemTemplate>
                            <li>
                                <asp:HyperLink ID="MenuLink" runat="server" NavigateUrl='<%# Eval("Url") %>'><span><%# Eval("Title") %></span></asp:HyperLink>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>
        </td>
        </tr>
        
        <tr>
       
        <td class="pageleft" style="height: 525px">
    <%--        <uc1:NavigationTree ID="NavigationTree1" Runat="server" />
    --%>    </td>
        
        <td class="pagecenter" style="height: 525px">
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"><br />
            </asp:contentplaceholder>
            </td>
       
        <td class="pageright" style="height: 525px">
            <br />
             
            <uc4:Search ID="Search" Runat="server" />
             &nbsp;
             <uc8:FeatureMember ID="FeatureMember" Runat="server" />
             
            <br />
        </td>
        
        </tr>
        
        <tr>
        
        <td colspan="3"> 
     
         <div id="Div1">
          <div id="footer_nav">
    			     <asp:Menu runat="server" ID="Menu1" DataSourceID="SiteMapDataSource" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="0" Orientation="Horizontal">
    			    </asp:Menu>
    	  </div>
           <div id="footertext">
               <small>Copyright &copy; 2008 Mathieu Cupryk &amp; <a href="http://www.omegalove.com">OmegaLove</a><br />
               </small>
           </div>       
        </div>
        <br />
     
        </td>
        
        </tr>
        
     </table>
            <asp:SiteMapDataSource ID="SiteMapDataSource" runat="server" ShowStartingNode="False" />
     </form>
     
    </body>
    </html>
    

  •  Advertisement

    Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.

     
  • 09-08-2008 12:15 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

     Now I see you complete login code. I think there is a mixed up with asp .net form loginView with ajax authentication service. If you want to use a client centric and ajax approach, the asp .net server side loginview will not work as it is intended to.

    this is a complete example. You need to modify your code

    http://asp-net-help.blogspot.com/2008/08/using-forms-authentication-with-aspnet.html

  • 09-08-2008 3:45 PM In reply to

    • macupryk
    • Top 25 Contributor
    • Joined on 08-04-2008
    • Wannabe Slacker
    • Points 862

    Re: I have a problem with refreshing login membership page on the master page.

    Can you please just help me get started on the conversion now from a loginview control to the approprtiate ajax control.

    This would be great. 

  • 09-08-2008 4:03 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

     we are talking about two things, right? The login part is independant from or  the profile part you are trying to develop.

    In the profile page, for example, if you are trying to list for a new user all of the articles he/she has written, as in the example given by Sonu, then I suggest you use a datalist for the task. Moreover, since you like to use AJAX, I suggest you use the DataList in the ADC suite. The difference between an ADC datalist and a asp .net DataList is that the ADC is a client-side control, it uses very often a web service as its datasource.  ...

    To me, both are ok for your purpose.

     

     

     

  • 09-09-2008 1:26 AM In reply to

    • macupryk
    • Top 25 Contributor
    • Joined on 08-04-2008
    • Wannabe Slacker
    • Points 862

    Re: I have a problem with refreshing login membership page on the master page.

  • 09-09-2008 8:23 AM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

    that is a good one. Thanks 

  • 09-09-2008 8:55 AM In reply to

    • macupryk
    • Top 25 Contributor
    • Joined on 08-04-2008
    • Wannabe Slacker
    • Points 862

    Re: I have a problem with refreshing login membership page on the master page.

    I just would like to learn ajax and javascript very well. Something tells me there is a hidden gem behind this. Someone will discover it.

    I know you've probably worked on sites before. Do you have any examples of a profile page in ajax asp.net.

  • 09-09-2008 10:42 AM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

     profile is used as too vague a term. And the sample Sonu provided you is strictly not a profile. So, now the question what you are trying to accomplish?

    In terms of using the profile service of asp .net ajax, there are a lot of online articles.

     

  • 09-09-2008 2:39 PM In reply to

    • macupryk
    • Top 25 Contributor
    • Joined on 08-04-2008
    • Wannabe Slacker
    • Points 862

    Re: I have a problem with refreshing login membership page on the master page.

     if u join a dating site u will see a profile of a user and understand what I am talking about.

  • 09-09-2008 3:24 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

     I do not really want to join a dating site, not today :), so you may just simply post your ideas here. A screenshot will do.

  • 09-09-2008 4:39 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Wannabe Slacker
    • Points 15,067

    Re: I have a problem with refreshing login membership page on the master page.

    Copied from this article http://www.codeguru.com/csharp/.net/net_asp/miscellaneous/article.php/c13337__3/

     Sys.Services.ProfileService.load
          (null,EndProfileLoad,OnProfileFailed, null);

    function EndProfileLoad(numProperties, userContext, methodName)
    {
       document.getElementById('TextBox3').value =
          Sys.Services.ProfileService.properties.FullName;
       document.getElementById('TextBox4').value =
          Sys.Services.ProfileService.properties.DOB;
       document.getElementById('TextBox5').value =
          Sys.Services.ProfileService.properties.Address.Street;
       document.getElementById('TextBox6').value =
          Sys.Services.ProfileService.properties.Address.Country;
       document.getElementById('TextBox7').value =
          Sys.Services.ProfileService.properties.Address.PostalCode;
    }
    

     

Page 1 of 1 (11 items)