I use set/get in code-behind of Default.aspx.
>> In your code you indicated that the Session object existed when you set
>> the session variable, but not when you read it? It doesn't make sense that
>> the existance of the Session object would be different depending on if you
>> try to read or write a value. Where do you use the property? When does the
>> Session object exist?
> I use set/get in code-behind of Default.aspx.
When does the Session object exist?
>> The web site can have session state enabled or disabled, but that is a
>> global setting for the site. If disabled, there won't be any Session
>> objects at all.
> I have session enabled in my web.config:
> <sessionState mode="InProc" timeout="20" />
If the session state is disabled in IIS, the setting in web.config
doesn't have any effect.

Signature
Göran Andersson
_____
http://www.guffa.com
R.A.M. - 16 Oct 2007 15:23 GMT
> When does the Session object exist?
I am not sure if I understand you... I can use Session from Default.aspx in
Admin...get. In Admin...set it is not accessible.
> If the session state is disabled in IIS, the setting in web.config doesn't
> have any effect.
I don't use IIS, because it didn't work on my computer. I use Cassini v2 on
Windows XP Professional.
Göran Andersson - 16 Oct 2007 19:05 GMT
>> When does the Session object exist?
> I am not sure if I understand you... I can use Session from Default.aspx in
> Admin...get. In Admin...set it is not accessible.
That doesn't make sense at all. Can you show the code that is using the
properties?
>> If the session state is disabled in IIS, the setting in web.config doesn't
>> have any effect.
> I don't use IIS, because it didn't work on my computer. I use Cassini v2 on
> Windows XP Professional.
Which should have the corresponding setting.

Signature
Göran Andersson
_____
http://www.guffa.com
R.A.M. - 17 Oct 2007 12:54 GMT
> That doesn't make sense at all.
But it's true.
> Can you show the code that is using the properties?
Here you are (property Admin.CurrentDatabase):
public partial class DefaultPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Display message:
if (Session["Message"] != null)
MessageLabel.Text = Session["Message"].ToString();
else
MessageLabel.Text = String.Empty;
// Display error:
if (Session["Error"] != null)
ErrorLabel.Text = Session["Error"].ToString();
else
ErrorLabel.Text = String.Empty;
// Setting up the database:
if (Admin.CurrentDatabase == null)
{
Admin.CurrentDatabase = (Admin.CurrentUserName ==
Admin.DemoUser ?
Admin.DemoDatabase:
Admin.DefaultDatabase);
if (Admin.CurrentDatabase != null)
{
Admin.ClearLog();
Admin.WriteToLog(Resources.MIM_Magazyn.SelectedDatabase
+ ": " +
Admin.CurrentDatabase);
}
else
{
Session["Error"] =
Resources.MIM_Magazyn.CannotSetupDatabase;
Response.Redirect("Error.aspx");
}
}
}
}
}
Göran Andersson - 17 Oct 2007 17:27 GMT
>> That doesn't make sense at all.
> But it's true.
[quoted text clipped - 22 lines]
> {
> Admin.CurrentDatabase = (Admin.CurrentUserName ==
So the Session object is not null here?
> Admin.DemoUser ?
> Admin.DemoDatabase:
> Admin.DefaultDatabase);
> if (Admin.CurrentDatabase != null)
But here?
> {
> Admin.ClearLog();
[quoted text clipped - 12 lines]
> }
> }
If that is in fact true, then your installation is not capable of
running applications. It's seriously broken, and in need of repair or
reinstallation.

Signature
Göran Andersson
_____
http://www.guffa.com