Date parsed: 06/10/2007 07:13:08
Date: Sat, 6 Oct 2007 11:13:08 -0400
I don't know what to say about Profile because it appears to be a custom
object, but as for Session, this will probably fix your problem:
http://www.geekpedia.com/Question85_The-name-Session-does-not-exist-in-the-current-context.html"Michael Nemtsev"; "MVP" <nemtsev@msn.com> wrote in message
news:3d9fba1aed718c9d6902739cf00@msnews.microsoft.com...
> Hello R.A.M.,
>
> What's the the Profile.Database? where did u get this?
>
> ---
> WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
>
http://spaces.live.com/laflour> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
> R> Hello,
> R> I am writing ASP.NET application in which I need to use User Profiles
> R> and
> R> Session mechanisms.
> R> Here I include part of my source code (Admin.cs):
> R> using System;
> R> using System.Data;
> R> using System.Data.Sql;
> R> using System.Data.SqlClient;
> R> using System.Data.SqlTypes;
> R> using System.Configuration;
> R> using System.Web;
> R> using System.Web.Security;
> R> using System.Web.SessionState;
> R> using System.Web.Hosting;
> R> using System.Web.Profile;
> R> using System.Diagnostics;
> R> /// <summary>
> R> /// Administrative settings and functions
> R> /// </summary>
> R> public static class Admin
> R> {
> R> /// <summary>
> R> /// Default database name
> R> /// </summary>
> R> public static string DefaultDatabase
> R> {
> R> get
> R> {
> R> if (Profile.Database != null) // HERE PROBLEM #1
> R> return Profile.Database.ToString();
> R> ...
> R> }
> R> }
> R> /// <summary>
> R> /// Current database name
> R> /// </summary>
> R> public static string Database
> R> {
> R> set
> R> {
> R> Session["Database"] = value; // HERE PROBLEM #2
> R> }
> R> ...
> R> }
> R> ...
> R> }
> R> I have compile-time errors:
> R> #1: Name "Profile" doesn't exist in current context
> R> #2: Name "Session" doesn't exist in current context
> R> In Web.config I have:
> R> ...
> R> <profile defaultProvider="SqlProfileProvider">
> R> <providers>
> R> <clear/>
> R> <add name="SqlProfileProvider"
> R> type="System.Web.Profile.SqlProfileProvider"
> R> connectionStringName="SqlServices" applicationName="MIMMagazyn"/>
> R> </providers>
> R> <properties>
> R> <add name="OperatorName" type="String"/>
> R> <add name="Database" type="String"/>
> R> <add name="DefaultStockName" type="String"/>
> R> <add name="DefaultCategoryName" type="String"/>
> R> <add name="Remarks" type="String"/>
> R> </properties>
> R> </profile>
> R> ...
> R> R> Could you tell me please how to use Session and Profile in my code?
> R> Did I
> R> missed something?
> R> /RAM/
>
>