我只想登录表单的特定时间段 [英] I want login form only particular time period

查看:83
本文介绍了我只想登录表单的特定时间段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

申请登录表格..

用户名:TextBox

密码:TextBox



登录(按钮)



i只想在特定的时间段内登录此表格..这意味着它的开放时间仅为上午10:00 Am - 10:30 Am。 ..使用Asp.Net



请朋友帮助我



我尝试过:



申请登入表格..

用户名:TextBox

密码:TextBox



登录(按钮)



i想要只登录此表单的特定时间段..这意味着它只打开

10:00 Am - 10:30 Am ...使用Asp.Net

解决方案

登录按钮单击事件,检查 DateTime.Now 并做任何你想做的事。

登录按钮点击活动

获取当前时间

然后在10:00 Am - 10:30 Am检查此时间
如果为真则转到认证其他显示用户友好消息。



喜欢:



 TimeSpan start =  new  TimeSpan( 10  0  0 );  //   10点 
TimeSpan end = new TimeSpan( 10 30 0 ); // 10:30
TimeSpan now = DateTime.Now.TimeOfDay;

if ((现在> start)&&(now < end))
{
// 找到匹配
AuthenticateUser();
}
其他
{
// < span class =code-comment>找不到匹配

}


Application Login Form..
User Name :TextBox
Password : TextBox

Login(Button)

i want login this form only particular time period ..it means its open's only
10:00 Am - 10:30 Am...using Asp.Net

please friend's Help Me

What I have tried:

Application Login Form..
User Name :TextBox
Password : TextBox

Login(Button)

i want login this form only particular time period ..it means its open's only
10:00 Am - 10:30 Am...using Asp.Net

解决方案

In Login Button Click Event, check the DateTime.Now and do whatever you want to do.


on login button click event
Get current time
Then check this time between 10:00 Am - 10:30 Am
if true then go to authentication else show user friendly message.

Like :

TimeSpan start = new TimeSpan(10, 0, 0); //10 o'clock
TimeSpan end = new TimeSpan(10, 30, 0); //10:30 o'clock
TimeSpan now = DateTime.Now.TimeOfDay;

if ((now > start) && (now < end))
{
   //match found
   AuthenticateUser();
}
else
{
   //not match found
}


这篇关于我只想登录表单的特定时间段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆