[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Access session in Application_AuthenticateRequest

Posted on 2006-07-19
7
Medium Priority
?
2,257 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
[X]
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
  • 2
7 Comments
 
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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

650 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