Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access session in Application_AuthenticateRequest

Posted on 2006-07-19
7
2,159 Views
Last Modified: 2008-01-09
i want to access session object in Application_AuthenticateRequest when i tries to it returns null

. how to do ?

or other wise is there any global place for the wole application to access the session object every time the user goes to a new page
0
Comment
Question by:hema3i
  • 2
7 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 17136856
0
 
LVL 7

Expert Comment

by:skvikram
ID: 17140787
YES in web.config saved in root directory of application

<configuration>
  <system.web>
    <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" />
  </system.web>
</configuration>

OR

<configuration>
  <system.web>
    <sessionState
       mode="SQLServer"
       sqlConnectionString="Server=127.0.0.1;UID=sa;PWD=secret" />
  </system.web>
</configuration>
0
 
LVL 3

Accepted Solution

by:
alecpotts earned 50 total points
ID: 17242536
The session object is the "per user" state object; while the Application_AuthenticateRequest is a mehtod that fires at the application level, rather than at the session level. If you try to access the session object here, I don't believe ASP .NET will have any way of knowing which user you are working with, and hence session returns null.

Try using the application state object; this is global to the application. So...

Application["MyStuff"] instead of  Session["MyStuff"]

Regards
0
 
LVL 3

Expert Comment

by:alecpotts
ID: 17388341
Hi,

I believe my answer is technically accurate - of course I don't know if it helped or not...!

IMO the answer from skvikram describes how to set up your session state in different ways, but not how to access it.

The last (and to a lesser extent, the first) link provided by pradeepsudharsan describe a similar problem, so could have been useful also.

Alec
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question