Forums » .NET » ASP.NET »

how to use session in C# Windows Application


Posted Date: 19 Sep 2007      Posted By:: Karthick Profile photo    Member Level: Gold    Member Rank: 0     Points: 2   Responses: 4



hi Friends,
Pls reply the method of Session maintenence in C# Windows Application. If u have any examples pls fwd its very useful for me.
Regards,
Karthick.




Responses

#152423    Author: Satish Kumar J      Member Level: Gold      Member Rank: 28     Date: 19/Sep/2007   Rating: 2 out of 52 out of 5     Points: 2

we dont have Session object in Window application

if want to you can use global variable please check below link for example.
http://www.thescripts.com/forum/thread486343.html

Regards,
Satish.

Regards,
Satish


 
#152429    Author: Brainstorming Guy      Member Level: Gold      Member Rank: 38     Date: 19/Sep/2007   Rating: 2 out of 52 out of 5     Points: 2

Hi,
You can't work with session in windows application. If you want to persist some value, you can use the cache. You can download and install the Microsoft Enterprise Library and make use of Cache.

Regards,
Brainstorming Guy aka Venkatarajan A

Regards,
Brainstorming Guy aka Venkatarajan A

BEEN THERE. DESTROYED THAT.


 
#152442    Author: keerthi J M      Member Level: Bronze      Member Rank: 0     Date: 19/Sep/2007   Rating: 2 out of 52 out of 5     Points: 2

You can use static class to hold the the values of the variables temproverly upto closing the application.
It violets the OOPs consept but you can use it,
take a new class to your application ,Declare the variables as static as shown below,

 
using System;
using System.Collections.Generic;
using System.Text;

namespace DvmsProject
{
class clsStaticApplication
{
/

//User Name

public static string strUserName;
public static string UserName
{
get
{
return strUserName;
}
set
{
strUserName = value;
}
}
//Pass Word
public static string strPassword;
public static string Password
{
get
{
return strPassword;
}
set
{
strPassword = value;
}
}


}
}

you are taken user name in a text box in the first form,
assign text value to the static class variables ,
ex,
 
clsStaticApplication.UserName=TextBox1.Text.ToString();

Remember that for a static class no need to create an object ,you can use these variables directly using classname with properties,

Then you can get the values of the textbox in the others pages using the static variables
 
string UserName=clsStaticApplication.UserName;


If any douts regarding these let me know ,





 
#152667    Author: Karthick      Member Level: Gold      Member Rank: 0     Date: 20/Sep/2007   Rating: 2 out of 52 out of 5     Points: 2

How to get value from session in another form?

 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

Namrata
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India