.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Different Sessions

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :Sql Server


I have 2 applications: .Net 1.1 application (wrote by another company) and Java application (our app).
Both apps use a same user and password to access to SQL Server 2005 (In some places it is Express release).
When I open .Net app, it reads and shows info. Also I can change info and it is writing to DB. Also I have refresh button to reload info from DB.
If I use 2 .Net apps, it are seeing a changes between them.
After openning .Net app, I am using Java app. Java app is writing some info to DB. But when I am going to .Net app and push refresh button, it doesn't bring me a changes from Java app. For get a changes I need to close .Net app and start it again (Java app can be still up, and we don't need to close it).
As I think, it can be 2 different sessions and closing .Net app are free some resourses. 

For fixed this problem I have tried: using 2 different SQL users, using SQL user + Windows user. But I have still a same problem.

Can you suggest me any solutions?


The .NET programmer

View Complete Post

More Related Resource Links

Information about sessions


Some questions about sessions:

I know sessions information is stored in the form of cookie and you can use qurystring for that if you set cookieless session in web.config. But I don't exactly understand the scope of a session.

What I believe is when you login to a website, a session cookie is created and the scope of that session is within that page only. If you close the browser that session gets killed and when you open the browser again and go to that site then a new session is created ie a new session is created on every request. Is this correct?

But I have seen in many websites, even if you close the browser and open it again the session is not killed, how does that happen?

Can anyone clear out and explain the scope/lifetime of sessions


ASP.Net sessions



Is there a way to access a session of ASP.Net application from a windows based application and check if it has exceeded a certain number of minutes then the windows based application should be able to kill that session. I am looking for the right kind of object that can allow me to access a list of sessions that are currently in use but have been idle for a while.

I might end up creating a windows service hosted on a web server that would run probably every 5 minutes or more and check for such idle sessions and kill any that have exceeded the limit.

One class that I found out related to sessions is. Am I in the right direction?


Looking for some inputs.



Sessions and null



 I have the following code

if (Session["vip_email"] != null || Session["vip_email"] != ""  )
                tb_email.Text = Session["vip_email"].ToString();

It breaks because it always thinks that the session is not null when it is (Object reference not set to an instance of an object.)

Am I using sessions correctly in asp.net

Can someone please assist?




Separate sessions in browser tabs together with an ajax enabled web site


I want my tabs in my browser to have separate sessions. I  was told to use

<sessionState mode="InProc" cookieless="UseUri"></sessionState> in web.config

 but when I read about it here: http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=VS.100).aspx

the text says "When you configure an AJAX-enabled ASP.NET Web site, use only the default value of UseCookies for the cookieless attribute. Settings that use cookies encoded in the URL are not supported by the ASP.NET AJAX client script libraries."

I'm using Ajax so are there any ideas what I can do about this problem.

Download the PowerPoint Files Used in Sessions During the SharePoint Conference

View PowerPoint files that represent a selection of the ten most popular SharePoint 2010 and Office 2010 developer track sessions at the conference.

OPEN SYMMETRIC KEY - Persist Across Sessions

We have a client .NET WPF application which connects to a local SQL 2008 Express server.  We are using symmetric SQL encryption to encrypt some columns.  In order to encrypt or decrypt, we must first open the symmetric key.  We have a logon trigger which opens the key automatically for us. Unfortunately, the key is opened A LOT due to the key being closed after each session closes.  This causes the CPU to peg at 100%.  We are using connection pooling and it would be wonderful to have the key remain open across sessions.  Anyone have any thoughts on how to do this?

How to manage multiple sessions from the same pc

#Newbie alert#  Only 8 months experience with school education back in 2002.   I'm using VS 2008, C# 3.5 to develop my own login system for our company website. Originally we have a "simple" design which only had a login and order page. That order page needs to be opened for 10-12 hours at the time while our stores are opened without having to relog into the system for each query. We also have a requirement that some users need to access 2 different compagnies (separate inventories) which require 2 different logins. I solved that "cross over" session problem by moving all the values into viewstate with my own viewstate manager class right after the login. Now my problem is that we are adding more and more pages and I don't want to be stuck with the problem to resave the viewstate to session and then back on viewstate for every menu items and buttons.   Is there a way to create some sort of items list of all the sessions opened by the user and only transmit that from pages to pages?

Coding is not working for Making Password Field Encrypted in sql and using sessions .basically its a

Dim cn As SqlConnection         Dim cmd As SqlCommand         Dim dr As SqlDataReader         cn = New SqlConnection         cn.ConnectionString = ConfigurationManager.ConnectionStrings("fees_systemConnectionString").ToString         cn.Open()         cmd.Connection = cn         cmd.CommandType = CommandType.Text         Dim Hashpass As String = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "sha1")         cmd.CommandText = "Select * from login where username='" & Me.txtUsername.Text & "' and password = '" & Hashpass & "'"         Dim re As SqlDataReader = cmd.ExecuteReader()         If re.HasRows Then             While re.Read()                 Session("email_id") = re("username").ToString()                 Session("MemberType") = re("type").ToString()                 Session("ISLOGIN&

To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the s

The following error is issued following 10 minutes of system inactivity: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/IParticipant/SearchParticipants' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding. Per the message, I tried changing the app config on the client from     receiveTimeout     ="00:10:00" to     receiveTimeout="10:00:00" but the change seems to have no impact.  What am I missing?

Javascript Sessions

Hi ,Say if got a radio button and when i click the radio button it gets it innerHTML then  it needs to save it as a session then to brings up a popup window and retrieve the innerHTML that is save in a session Any suggetions will be helpfullThx

Problem: Sessions got mixed up when open multiple tab for a sigle application

We got a problem that Sessions got mixed up when open multiple tab in a single application. We could change the code that do not use session variable in a that level, but a tons of page need to be modified. We need to find a quick fix for this problem. Is any thing we can do in code level to prevent user open multiple tab in a single application? O any thing we can do to keep its own session for a single tab?

counting page Sessions based on databound grid row - please help

Hi, I would like to count the number of page views. I am able to use the global.asax file and a label to obtain this. However, this gives me the total count of the page. That is great, however I like to count the number of users accessing the page when the user clicks on a particular gridview row value from the previous page. I have a gridview in the gridview a value that links to a new page. This new page contains the row values. I would like to count the number of users who have accessed this new page based on the gridview row value. As such the page count will be different based on each row. Please assist, if anyone has a sample using gridview and a hyperlink to a new page with a session count of that new page that would be fantastic. Thank you in advance. Nijojo.  

Problem with sessions


I want to count visiters on my page . I set a session if the visitor is counted, but it will not work, the visitor counts everytime the page loads. I have this code i my masterpage in page_Load.

// Count visitor...
        if (Session["visit"] == null)
            if (Request.Cookies["visitAll"] != null)
                Session["visit"] = "On";
                Session["visit"] = "On";
protected void setCookie()
        HttpCookie cookie = new HttpCookie("visitAll", DateTime.Now.ToString());
        int howManyDays = 365;
        TimeSpan timeSpan = new TimeSpan(howManyDays, 0, 0, 0);
        DateTime expirationDate = DateTime.Now.Add(timeSpan);
        cookie.Expires = expirationDate;


sessions or application


if I create an application session (application["sessionname"])

and I cast it in a page 

does it make a copy of the session or does it by ref?

for example im creating a dataset when an application starts and then saving it as application

then when i need to look something up that applies to everyone i cast it to a dataset

does it make a copy when i cast or does it do it by reference?

Users, Sessions, Processes, Instances, Database Engine

Can you depict me the existing relation between Users, Sessions, Processes, Instances and Database Engine of SQL Server?

Will sessions kill when application error occurs which is in global.aspx


can you please tell Will sessions kill when application error occurs which is in global.aspx ?



void Application_Error(object sender, EventArgs e)




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend