Session Problem?

A

Angel

Hi
I posted this message few days ago but nobody answer to it.
Still have the same problem and I am hoping this time somebody will be able
to help me with it.

I have a problem with my web application. I believe the problem is
somehow related with HttpSession.
I use form authentication in my project. Once I authenticate the user and
redirect to default page
I create an User object and assign this object to session["MyUserObject"].
Then in other forms I access this object and use it to load data from
database. Some times I keep
data in the object as a property of object. For example let say my object is
student. I read student courses
and keep them as student.courses property of my user object.
It works fine but when I deploy the project to web server after some time
(may be 30 min, some timeout probably ) I start throwing following error:

Configuration Error ....

Parser Error Message: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.

Source Error:


Line 44: by Microsoft that offers a single logon and core profile
services for member sites.
Line 45: -->
Line 46: <authentication mode="Forms"> //THIS LINE IS MARKED WITH RED
COLOR
Line 47: <forms loginUrl="Secure/Login.aspx"
Line 48: name = "ASPXAUTHPCRWS"


I noticed that I get the same error if I try to assign null value to
session["MyUserObject"] in Global.aspx Session_end event handler.
Then I removed the session["MyUserObject"] = myobj from the code and the
errors sopped.
Of course my application stopped working as well since I need this object
later in my program.

I thought that the reason is that I assign session["MyUserObject"] =
myobj before user have been authenticated by
FormsAuthentication.RedirectFromLoginPage(srlzobj, false);

but the change I made to fix this does not seems to work either.

Thanks for your reply. I am getting really desperate here.
Angel
 
W

William F. Robertson, Jr.

This might be a wild goose chase, but what does your directory structure
look like? Where are the applications defined in IIS? (what directories,
nested?)

But this should fail instantly. Are you saying you can log in, browse
around, then it blows up after 30 minutes or so? Of active browsing or the
first Session Timeout?

bill
 
A

Angel

This is what is happening.
I install application login, log out, create multiple sessions, browse OK.
Some time later (30min, one hour , next day . ) I try to login again. It
authenticates me and I believe on the line I say
Session["MyObject"] = MyObject it crashes.
 
W

William F. Robertson, Jr.

I believe I misread what you typed earlier, or did read it clear enough. I
do not believe you have access to the Session variable in the Session_End
event. It was years ago, but I believe I ran into problems with it.

I am sorry that I will not be able to help you more without seeing more
code. For debugging purposes, attach on to the Application_Error method in
global.cs. Pull out the Server.GetLastError() exception and send that error
to yourself with email. The error message you posted, really has nothing to
do with an ArgumentNullException error. But I could be mistaken.

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top