asp.net(C#Web窗体按钮)clickinn和刷新页面 [英] asp.net (c# web form button) clickinn and refreshing page

查看:93
本文介绍了asp.net(C#Web窗体按钮)clickinn和刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我在asp.net(框架4)中有一个登录页面,我使用c#即时消息,好了,当我输入用户名和密码时,然后单击登录按钮(而不是其Web表单按钮的html按钮),它会执行类代码(检查数据库),但是,我必须再次单击它以使我转至CMS的主页.和ia在我所有的按钮中都存在相同的问题,即使我单击添加按钮进行上传,它也会刷新页面,甚至注销时,我也必须单击两次!当会话刷新页面时,我所有的变量(int字符串...)都丢失了,我使用了1分钟超时的会话.这对我来说是个大问题,所以我应该怎么做才能避免通过单击按钮来刷新页面!登录页面的事件处理程序,您可以:

 如果(IsPostBack)
{
    验证指定的用户凭据
}
如果(用户有效有效)
{
    Response.Redirect(" );
} 



您是否在调试器下运行页面以查看发生了什么?


hi
i have a log in page in asp.net (framework 4) and im using c# , well, when i enter username and password , then i click on login button (not a html button its web form button) it do the class code (checking the data base) but , i have to click again on it to reffer me to main page of my CMS. and ia have the same problem in all of my buttons , even when i click on a add button to do upload it refreshs the page , or even in log out, i have to click on it two times! and i use session with 1 min time out, when it refreshs the page all my variables (int string ...) had lost. and its a big problem for me, so what should i do to avoid refreshing page by clicking the buttons!!!??????

解决方案

In your Page_Load event handler of your login page, you can :

if (IsPostBack)
{
    verify specified user credentials
}
if (user is valid)
{
    Response.Redirect("loggedin.aspx");
}



Have you run your page under the debugger to see what''s happening?


这篇关于asp.net(C#Web窗体按钮)clickinn和刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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