1

I would like to seek for help regarding a user authentication that I wanted to accomplish.

Current setup of Main Page:

  1. Consists of simple display of items
  2. Basic search functionality
  3. Login functionality (Username textbox, Password textbox and Login button)

When the user logged in, additional functionality will prompt into the current web page (At this point, it is still working).

Now the problem is, when I clicked the refresh button, the user reverts back to "not logged in" state. What I wanted is, whenever the user clicked the refresh button, the user will still be on "logged in" state.

Additional info: On my ASP page (Main Page), I am instantiating the session variable with this line:

<%
 Session["IsLogged"]=0;
%>

And I have an internal script to get the session variable to be available to my external javascript:

<script type="text/javascript" language="javascript">
 var isLogged = '<%= Session["IsLogged"] %>';
</script>

My login function is being handled by jquery and .aspx.cs wherein I am setting the session variable when a user logged in with this code:

HttpContext.Current.Session["IsLogged"] = 1;

Can you guys help me out? Thanks.

Cheran Shunmugavel
8,4691 gold badge35 silver badges41 bronze badges
asked Jul 7, 2013 at 6:36

1 Answer 1

1

Take the code out

<%
 Session["IsLogged"]=0;
%>

and that should work.

If you want the user to log out create a log out page and on the page, logout.asp, in that page do something like

 <%
 Session.Abandon
 %>

The user should also be logged out automtically when he closes his web browser

answered Jul 7, 2013 at 6:46
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.