将login控件转化成模板,隐藏“checkbox”,增加一个dropdownlist,然后在点击“login”按钮时传入票据期限,应该即可
呵呵,没有测试

解决方案 »

  1.   

    请看
    -----------------------------------------------------------------------After much seraching, I found a workable solution to this problem. Basically we need to manually set up the same client code that would be injected if we were using a Default button for a panel.Assume we have a <asp:Login ... /> control on a page named "Login1"In the Page_Load event handler:------ 
    Control ctl = Login1.FindControl("LoginButton");
    if(ctl != null && ctl is IButtonControl)
       Login1.Attributes.Add("onkeypress", string.Format("javascript:return WebForm_FireDefaultButton(event, '{0}')",ctl.ClientID));-------
    I'm assuming that we also have the WebForm_FireDefaultButton client script file available on the page... (if not - you'll get a JavaScript error) 
    ------------------------------------------------------------------------------------------------------------------------------------For those who are using the .Net 2.0 login control, I just thought about a hacky way to implement the scenario where users can hit the Enter key to fire the login button event, here is how it works:1- wrap your login control into a Panel and call it Panel1.2- inset a button on stage and call it dummyButton, set it's width and height  to 0, set it border to none and it is background anad foreground to white set it is text to empty string.( this is way, dummybutton will be invisible). If you are wondering why wouldn't I just set the visibility to false, well the answer is that it won't work.3- set the defaultbutton of Panel1 to dummyButton and set put this code the dummyButton your click handler bool crediteUser = Membership.ValidateUser(Login1.UserName, Login1.Password);if (crediteUser){FormsAuthentication.RedirectFromLoginPage(Login1.UserName,false);}
    ------------------------------------------------------------------------
    vb.net
    --------------------------------------------------------------------
    My Code Behind, just like the post:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim ctl As Control = userLogin.FindControl("LoginButton")
            userLogin.Attributes.Add("onkeypress", String.Format("javascript:return WebForm_FireDefaultButton(event, '{0}')", ctl.ClientID))
    End Sub================================================
    详细:http://forums.asp.net/thread/1466091.aspx
      

  2.   

    领导要求的是有记住密码这个选项,你可以试试别的方法,
    比如你自己按照login生成的代码写一个
      

  3.   

    回emanlee(造化弄人)
    --------------------------------------------------------
    该帖子我通篇看过了,从头到尾只讲解了一些如何定制使用Login控件,我也的确就是这样做的,但没有一条是讲解如何控制Login控件的Cookie到期时间的。所以对我帮助不大回Teng_s2000(分涨的太慢,升星难啊!!) 
    --------------------------------------------------------
    Login控件在登陆时会自动生成Cookie的,我想解决的是如何控制这个自动生成的Cookie,也就是想知道该重写哪个事件来获取并修改该Cookie,这才是问题的关键,手动创建Cookie就跟我一开始说的一样,网上非常多
    回sunjay117() 
    --------------------------------------------------------
    领导是要求我使用Login控件,而不是要一个记住密码选项
      

  4.   

    Dim ticket As FormsAuthenticationTicket
    ticket = New FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, ateTime.Now.AddMinutes(这就是时间, 填大一点数字不就可以了), True, objReader.GetValue(0).ToString, FormsAuthentication.FormsCookiePath)