Click here to Skip to main content
16,019,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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!!!??????
Posted

1 solution

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

C#
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?
 
Share this answer
 
Comments
nariman008 8-Jul-11 1:42am    
sry but i dont understand what the code do, but i think its not the answer to avoiding refreshing of page. for example , i have 4 panel in my main page, and when one is active others are deactive, in one of my panels (add new post) i have file uploader (for uploading picture) and a "add" button to save it on host, so when i press the add button, it adds the image but, it refreshes the page, and all of my panels get closed (deactivated and invisible [cause they are inactive in page load, and activated by pressing one of buttons]) and user have to click on the "new post" button to see the panel again.by the way , i use visual studio 2010, and ofcourse i run and debug it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900