R
R.A.M.
Hello,
I am writing ASP.NET application in which I need to use User Profiles and
Session mechanisms.
Here I include part of my source code (Admin.cs):
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Hosting;
using System.Web.Profile;
using System.Diagnostics;
/// <summary>
/// Administrative settings and functions
/// </summary>
public static class Admin
{
/// <summary>
/// Default database name
/// </summary>
public static string DefaultDatabase
{
get
{
if (Profile.Database != null) // HERE PROBLEM #1
return Profile.Database.ToString();
...
}
}
/// <summary>
/// Current database name
/// </summary>
public static string Database
{
set
{
Session["Database"] = value; // HERE PROBLEM #2
}
...
}
...
}
I have compile-time errors:
#1: Name "Profile" doesn't exist in current context
#2: Name "Session" doesn't exist in current context
In Web.config I have:
....
<profile defaultProvider="SqlProfileProvider">
<providers>
<clear/>
<add name="SqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices" applicationName="MIMMagazyn"/>
</providers>
<properties>
<add name="OperatorName" type="String"/>
<add name="Database" type="String"/>
<add name="DefaultStockName" type="String"/>
<add name="DefaultCategoryName" type="String"/>
<add name="Remarks" type="String"/>
</properties>
</profile>
....
Could you tell me please how to use Session and Profile in my code? Did I
missed something?
/RAM/
I am writing ASP.NET application in which I need to use User Profiles and
Session mechanisms.
Here I include part of my source code (Admin.cs):
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Hosting;
using System.Web.Profile;
using System.Diagnostics;
/// <summary>
/// Administrative settings and functions
/// </summary>
public static class Admin
{
/// <summary>
/// Default database name
/// </summary>
public static string DefaultDatabase
{
get
{
if (Profile.Database != null) // HERE PROBLEM #1
return Profile.Database.ToString();
...
}
}
/// <summary>
/// Current database name
/// </summary>
public static string Database
{
set
{
Session["Database"] = value; // HERE PROBLEM #2
}
...
}
...
}
I have compile-time errors:
#1: Name "Profile" doesn't exist in current context
#2: Name "Session" doesn't exist in current context
In Web.config I have:
....
<profile defaultProvider="SqlProfileProvider">
<providers>
<clear/>
<add name="SqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices" applicationName="MIMMagazyn"/>
</providers>
<properties>
<add name="OperatorName" type="String"/>
<add name="Database" type="String"/>
<add name="DefaultStockName" type="String"/>
<add name="DefaultCategoryName" type="String"/>
<add name="Remarks" type="String"/>
</properties>
</profile>
....
Could you tell me please how to use Session and Profile in my code? Did I
missed something?
/RAM/