TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mary jean ligas
NA
420
196.3k
Kill Session when Clicking logout
Nov 23 2012 6:11 AM
Hello Everyone,, Help me to kill the session when clicking logout. Heres the code
For CS
protected void lnkLogOut_Click(object sender, EventArgs e)
{
CLMSDataContext context = new CLMSDataContext();
try
{
Object uid = Session["User_Idx"];
Dim_User usr = context.Dim_Users.Single(u => u.User_Idx == Convert.ToInt32(uid));
Session["User_Idx"] = null;
Session["fullname"] = null;
Session["errorlog"] = null;
Session.Clear();
//usr.Status = null;
context.SubmitChanges();
Response.Redirect("~/Login.aspx");
Server.Transfer("Login.aspx");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
context.Dispose();
}
}
For ASPX
<div class="SubFont">
<%
if (Session["User_Idx"] == null)
{
Response.Redirect("Login.aspx");
}
else
{
%>
<span>Welcome <% Response.Write(Session["Fullname"]); %> | </span>
<asp:LinkButton runat="server" ID="lnkLogOut" Text="Logout"
onclick="lnkLogOut_Click" CssClass="ViewLive"></asp:LinkButton>
<%}%>
</div>
Reply
Answers (
4
)
c#vs c++/java
Write a function that displays at the left margin of the screen a solid square of asterisks