Completely Free .NET word API

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.


#152423    Author: Satish Kumar J      Member Level: Gold      Member Rank: 0     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.



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

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.

Brainstorming Guy aka Venkatarajan A

Venkatarajan A


#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
return strUserName;
strUserName = value;
//Pass Word
public static string strPassword;
public static string Password
return strPassword;
strPassword = value;


you are taken user name in a text box in the first form,
assign text value to the static class variables ,

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
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India