473,698 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve SessionID in Global asax

Does anyone know how to retrieve the current sessionId in
Global.asax.App licationError?

/k
Dec 28 '06 #1
11 4760
I am trying to use the SessionID as a key as proposed in:

http://groups.google.se/group/micros...9c79bb10436bec

"kurt sune" <ap*@apa.comwro te in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
Does anyone know how to retrieve the current sessionId in
Global.asax.App licationError?

/k


Dec 28 '06 #2
"kurt sune" <ap*@apa.comwro te in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
Does anyone know how to retrieve the current sessionId in
Global.asax.App licationError?

/k


Dec 28 '06 #3
"kurt sune" <ap*@apa.comwro te in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
Does anyone know how to retrieve the current sessionId in
Global.asax.App licationError?
Er, have you tried:

Session.Session ID
Dec 28 '06 #4
"kurt sune" <ap*@apa.comwro te in message
news:eW******** *****@TK2MSFTNG P06.phx.gbl...
>I am trying to use the SessionID as a key as proposed in:

http://groups.google.se/group/micros...9c79bb10436bec
You *CANNOT* use SessionID as any sort of unique key, because it is not
guaranteed to be unique in all cases.

See the following from the MSDN Library:
http://msdn2.microsoft.com/en-gb/library/ms524326.aspx
Dec 28 '06 #5
Yepp, it causes {"Session state is not available in this context."}

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:eF******** ******@TK2MSFTN GP06.phx.gbl...
"kurt sune" <ap*@apa.comwro te in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
Does anyone know how to retrieve the current sessionId in
Global.asax.App licationError?

Er, have you tried:

Session.Session ID


Dec 28 '06 #6
Came up with this:

In global.asax:
Dim s As String =
Request.Cookies .Item("ASP.NET_ SessionId").Val ue
If Not s Is Nothing Then Application(s) = "the error text"
Response.Redire ct("GenericErro rPage.aspx")

In the error page:

Dim s As String = String.Empty
s = HttpContext.Cur rent.Session.Se ssionID
Dim ee As String = Application(s). ToString
'display ee on the page

What do you think? A viable solution?

The article you mentioned says that the sessionid is unique between
restarts.

/m
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:Os******** ******@TK2MSFTN GP03.phx.gbl...
"kurt sune" <ap*@apa.comwro te in message
news:eW******** *****@TK2MSFTNG P06.phx.gbl...
I am trying to use the SessionID as a key as proposed in:
http://groups.google.se/group/micros...9c79bb10436bec
>
You *CANNOT* use SessionID as any sort of unique key, because it is not
guaranteed to be unique in all cases.

See the following from the MSDN Library:
http://msdn2.microsoft.com/en-gb/library/ms524326.aspx


Dec 28 '06 #7
"kurt sune" <ap*@apa.comwro te in message
news:um******** ******@TK2MSFTN GP03.phx.gbl...
Yep, it causes {"Session state is not available in this context."}
OK - how about

HttpContext.Cur rent.Session.Se ssionID
Dec 28 '06 #8
"kurt sune" <ap*@apa.comwro te in message
news:u9******** ******@TK2MSFTN GP02.phx.gbl...
What do you think? A viable solution?
No.
The article you mentioned says that the sessionid is unique between
restarts.
Er, no it doesn't. Try reading it again - specifically, the bit which says:

"if the Web server is restarted, some SessionID values may be the same as
those generated before the server was stopped."
Dec 28 '06 #9

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** *******@TK2MSFT NGP04.phx.gbl.. .
"kurt sune" <ap*@apa.comwro te in message
news:u9******** ******@TK2MSFTN GP02.phx.gbl...
What do you think? A viable solution?

No.
Why, please?
>
The article you mentioned says that the sessionid is unique between
restarts.

Er, no it doesn't. Try reading it again - specifically, the bit which
says:
>
"if the Web server is restarted, some SessionID values may be the same as
those generated before the server was stopped."
Yes, and when restarted all session and application data gets viped out
and the user has to connect again.

>

Dec 28 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2029
by: Mae | last post by:
Dear all, I'm new to Session.SessionID in Global.asax.vb I wanted to use the sessionID in "Application_AuthenticateRequest" to check for sessionID for each IE, for testing purposes I just put Response.Write(Session.SessionID), but it shows error message "Session state is not available in this context" after executing the page. In Web.Config I put the sesionState tag as below
2
2239
by: Berrucho | last post by:
Please Help! I recently posted this same issue but got no answer... please help Using VB.NET, IIS5, W2K Adv SP3 all patches, .net 1.0, VS.NET 2002 Using forms authentication, persistent cookie = false Recently my asp.net app is returning wrong data to users. Users frequently get data that should only be seen by other user.
8
2000
by: Brad Simon | last post by:
I have written a shopping cart using ASP .NET (VB). It has been running quite successfully on a site for about a year or so. I use the SessionID as the key to hold information on the shopping cart. I have copy / pasted the code into a new site. Everything is working, EXCEPT for the shopping cart holding the SessionID. I have watched the variable, and each time I hit the 'Update' button in a datalist, the session ID changes. That is...
4
8838
by: Andy Fish | last post by:
Hi, I have an asp.net application that is using Forms Authentication and maintaining http session state using cookies in the normal way. when the user clicks the logout button I do this: Session.Clear(); Session.Abandon(); FormsAuthentication.SignOut();
6
1797
by: Ibrahim. | last post by:
When a new request is made to the server a new session id is issued to the client (a browser instance). The problem I’m facing is that session id that is already assigned to a browser instance is getting recycled for another browser instance by ASP.NET When the client request is sent to Http server, the available session id’s (that is already present in the pool) are recycled from the session pool along with the authentication cookie. ...
11
8368
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the generated code on a W2K3 server the application_start and any other event on the global.asax file won't fire. I added tracing and logging to make sure and I can see the code is just not execution. When running the same exact (deployed etc.) code on...
16
5036
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="<Namespace>." %> I've done a lot of things I've found on the web to no avial, but here are some unique things about what is happening to me.
8
13198
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project compiles & runs fine locally, but when I copy to the production machine, I get this error: Parser Error Message: Could not load type 'Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="Global" %> Source...
15
2564
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the Global class. Note: I use these shared variables for read only values that are set at application start. It would appear the 2.0 doesn't like you to use shared variables in the global class. How do I convert my 1.1 applications to 2.0 without...
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9152
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9016
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.