ASP.NET

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentASP.NET

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old March 19th, 2012, 02:37 AM
ask2sankar ask2sankar is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 1 ask2sankar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 17 sec
Reputation Power: 0
Session Timeout

I have Lunched website in godady server windows hosting using Asp.net 3.5. in this Site used session variables for store Login values ...But in this Case I have check session variable every page load event. I have Mention the session timeout in the Web.config file as below



<sessionState timeout="600" mode="InProc" cookieless="false"></sessionState>

<authentication mode="Forms">

<forms path="/" loginUrl="Login.aspx" defaultUrl="Default.aspx" protection="All" timeout="600" slidingExpiration="true" cookieless="UseCookies" requireSSL="false" enableCrossAppRedirects="false"/>

</authentication>

<customErrors mode="On" defaultRedirect="ServerError.aspx">

</customErrors>
I exaplain as below... this is my code

Login.aspx i store login Data

Session["Profile"] = ETS.sqlDR["Profile"].ToString();
Session["UserName"] = ETS.sqlDR["Emp_FirstName"].ToString();

After that i load User Control DetailPanel.ascx

if (Session.Count != 0)
{
if (Session["UserName"] != null)
{
username.Text = Session["UserName"].ToString();
}
if (Session["Profile"] != null)
{
userprofile.Text = Session["Profile"].ToString();
}

}
else
{
Response.Redirect("Login.aspx");
}

Then Load Menu Panel UserControl MenuPanel.ascx

if (Session["Profile"] != null)
{
string menuCtrl = "";
if ( Convert.ToString(Session["Profile"]) == "Manager-Full")
menuCtrl = "ManagerMenu.ascx";
else if(Convert.ToString(Session["Profile"]) == "Manager")
menuCtrl = "SecondaryManager.ascx";
else if (Convert.ToString(Session["Profile"])=="User")
menuCtrl = "UserMenu.ascx";
else if (Convert.ToString(Session["Profile"])=="Admin")
menuCtrl = "AdminMenu.ascx";
this.PlaceHolder1.Controls.Clear();
this.PlaceHolder1.Controls.Add((UserControl)LoadCo ntrol(menuCtrl));
}

Then Load Menu Panel UserControl Mangermenu.ascx

if (!IsPostBack)
{
if (Session.Count != 0)
{
if (Session["Profile"] != null)
{

lblCount.Text = Application["OnlineUsers"].ToString();

try
{
divCheckList.Visible = false;
divLeave.Visible = false;
Tag1.Visible = false;
Tag2.Visible = false;
string Modules = "";
ETS.OpenConnection();
ETS.sqlCMD1 = new System.Data.SqlClient.SqlCommand("Select Modules from ETS_CompanyModules where Status='Active' and Comp_RefID="+Session["CompanyID"].ToString()+"", ETS.connection);
//ETS.sqlCMD1.Transaction = ETS.sqlTrans;
Modules = Convert.ToString(ETS.sqlCMD1.ExecuteScalar());
string[] Modnew;
Modnew = Modules.Split(',');
for(int i=0;i<=Modnew.Length-1;i++)
{
if (Modnew[i] != "")
{
if (Modnew[i] == "Tagging")
{
Tag1.Visible = true;
Tag2.Visible = true;
}
else if (Modnew[i] == "CheckList")
{
divCheckList.Visible = true;

}
else if (Modnew[i] == "Leave")
{
divLeave.Visible = true;

}
}
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterClientScriptBlock(this.G etType(), "Conformation", "alert('"+ex.Message.ToString()+"');", true);
}
finally
{
ETS.CloseConnection();
}
}
}
else
{
Page.ClientScript.RegisterClientScriptBlock(this.G etType(), "Conformation", "alert('Session expired');", true);
// Response.Redirect("HomePage.aspx");
}
}
}

In the above code i have mentioned detaily about my menu panel control

Now what's my problem is whenever the session expires it clear all my menu's which i have given in the above code and also it clears the data which is present in the detail panel. I dont know why it happens.

I have given the timeout as '600' min in the web config file sometimes it gets expires suddenly after when i login.Please explain me what is happening and i am searching for the solution for the past two weeks.

is there anything to change in my web config file as i mentioned in the last post? or any problem with my code which i have mentioned above?

Reply With Quote
  #2  
Old May 24th, 2012, 01:01 AM
vairaselvan vairaselvan is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 1 vairaselvan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 33 sec
Reputation Power: 0
session

pl add the session code in web configuration file....

Reply With Quote
  #3  
Old May 3rd, 2013, 09:11 AM
annaharris annaharris is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Apr 2013
Posts: 22 annaharris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 23 m 59 sec
Reputation Power: 0
Have you added session variables details in the web configuration file ?

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentASP.NET > Session Timeout


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap