How to use Session in web application ? [Resolved]

Posted by Akiii under ASP.NET on 6/6/2011 | Points: 10 | Views : 3600 | Status : [Member] | Replies : 14
Hi,
I want to use "session" in my web application...Please tell me how to do that ?
First, i thought about "querystring" but it doesn't provide security to sensitive information..

Any help is appreciated....

Thanks and Regards
Akiii




Responses

Posted by: SheoNarayan on: 6/6/2011 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Hi Akiii,

Read this article http://www.itfunda.com/how-to-use-session-variables/Free/200 and you should be able to understand how to use it and what is the benefit of it.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksingh on: 6/6/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi Akiii,

Read this article http://msdn.microsoft.com/en-us/library/ms972429.aspx to understand how to use all the session modes.

Modes are :
1. In proc
2. State Server
3. SQL Server



Regards,
Sunil

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 6/6/2011 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
Hi,

Refer this,

http://www.codeproject.com/KB/aspnet/ExploringSession.aspx
http://asp.net-tutorials.com/state/sessions/

Regards,
Susan

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayeshl on: 6/7/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
hi dear friend,

Session variable is used to store value thought page to page.
for Session variable in c#

syntax :

Session["variable name"] = "Value";
Example :
Session["Role"] = "Admin";

how to access this variable on page :

if (Session["Role"]!=null)
{
label1.Text = Session["Role"];
}
else
Response.Redirect("login.aspx");

thanks
from Jayesh L
http://sqlassistant.blogspot.com


Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Taanu51 on: 6/7/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
HI
Read this articles it may helps you

http://taanu51.blogspot.com/2011/02/how-to-transfer-values-from-one-page-to.html

http://taanu51.blogspot.com/2011/02/how-to-automatically-redirects-to.html

http://taanu51.blogspot.com/2011/02/how-to-create-logout-page-using.html

Let me know



Tanisha Sayyad
.Net and Android Developer
INDIA(Andhra Pradesh)

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 6/9/2011 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Refer this...

http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.71).aspx

Nitha Deepak

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 6/6/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi Akiii,
Refer This....
http://msdn.microsoft.com/en-us/library/ms178581.aspx
http://wiki.asp.net/page.aspx/57/session/

Thanks,

Nitha Deepak

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
@SheoNarayan sir....

Sir the link that u recommended to me helped me a lot....

Thanks and Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
hi nitha....

thank you for ur reply.....
i didnt understand the code in web.config file....like
<configuration>

<system.web>
<sessionState cookieless="true"
regenerateExpiredSessionId="true" />
</system.web>
</configuration>


do you have any example to refer to??

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
@Sksingh .....

thanks for the links...
let me read those and i will get back to you.....if any problem arises..

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
@susan.....and @Jayesh

Thanks for ur help.....
Are the session value safe if i am holding that in the session variable...?
is it stored in a hidden variable ?

Thanks and Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
@Tanisha...

Thanks for the links.....
I didnt understand "How to Automatically Redirects to LoginPage when Session Timeout"......
please can you elaborate on this ?

Thanks and Regards
Akiii


Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/13/2011 [Member] Bronze | Points: 25

Up
0
Down
hi nitha...thanks for the reply.....

now my web application is redirecting to the default page when session expires...

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 6/14/2011 [Member] Bronze | Points: 25

Up
0
Down
pls mark it resolved if you got your problem solved.

Nitha Deepak

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response