I get the following error:
PageInit.cs(43, 71): error CS0246: The type or namespace name 'User' could
not be
found (are you missing a using directive or an assembly reference?)
The error is from the last line in this snippet of code
*************** *************** ***********
using System;
using System.Web;
using System.IO;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.Sess ionState;
using System.Data;
using System.Data.Sql Client;
using System.Collecti ons;
using Microsoft.Visua lBasic;
using MyFunctions;
namespace MyFunctions
{
public class PageInit
{
public static void PageSetup(MyFun ctions.Page thePage)
{
HttpContext.Cur rent.Session["LastPageVisite d"] =
(User)HttpConte xt.Current.Sess ion["User"].LastPageVisite d;
*************** *************** *************** *************** **
I have stored and object "User" in my session variable and am trying to get
access to LastPageVisited . I originally didn't have the (User) in front of
the line and got the error that LastPageVisited didn't exist. So I typecast
the whole string - but got the error:
I have a User Class in the MyFunctions namespace that is in the compiler
line:
C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ csc /t:library PageInit.cs
/r:system.web.dl l /r:system.data.d ll /r:system.dll
/r:Microsoft.Vis ualBasic.dll /r:refresh.dll /r:User.dll
And the User Class is setup like:
*************** *************** *************** ****
using System;
using System.IO;
using System.Data;
using System.Data.Sql Client;
using System.Configur ation;
using System.Collecti ons;
using MyFunctions;
using FtsData;
namespace RolesBasedAuthe ntication
{
[Serializable]
public class User
{
private string lastPageVisited = "";
....
public string LastPageVisited
{
get { return lastPageVisited ; }
set { lastPageVisited = value; }
}
*************** *************** *************** *****
So do I need to change the following line to work?
(User)HttpConte xt.Current.Sess ion["User"].LastPageVisite d;
The problem seems to be the User doesn't exist but it does (doesn't it?).
Thanks,
Tom 3 1258
On 2007-10-30 22:09:37 -0700, "tshad" <tf*@dslextreme .comsaid:
I get the following error:
PageInit.cs(43, 71): error CS0246: The type or namespace name 'User' could
not be
found (are you missing a using directive or an assembly reference?)
[...]
I have stored and object "User" in my session variable and am trying to get
access to LastPageVisited . I originally didn't have the (User) in front of
the line and got the error that LastPageVisited didn't exist. So I typecast
the whole string - but got the error:
I have a User Class in the MyFunctions namespace
If the User class is in the MyFunctions namespace, then why does it
appear in the RolesBasedAuthe ntication namespace in the code you posted?
Without a concise-but-complete sample of code to look at, it's
impossible to tell. But the code you posted does not match your
assertion about it. If the code is correct, your assertion is
incorrect and you can access the class simply by specifying the correct
namespace for it (or including the namespace in your "using" section).
Pete
"Peter Duniho" <Np*********@Nn OwSlPiAnMk.comw rote in message
news:2007103023 425816807-NpOeStPeAdM@NnO wSlPiAnMkcom...
On 2007-10-30 22:09:37 -0700, "tshad" <tf*@dslextreme .comsaid:
>I get the following error:
PageInit.cs(43, 71): error CS0246: The type or namespace name 'User' could not be found (are you missing a using directive or an assembly reference?)
[...] I have stored and object "User" in my session variable and am trying to get access to LastPageVisited . I originally didn't have the (User) in front of the line and got the error that LastPageVisited didn't exist. So I typecast the whole string - but got the error:
I have a User Class in the MyFunctions namespace
If the User class is in the MyFunctions namespace, then why does it appear
in the RolesBasedAuthe ntication namespace in the code you posted?
You're right.
I had thought User was in the MyFunctions namespace and it was actually in
the RolesBasedAuthe ntication namespace.
Thanks,
Tom
>
Without a concise-but-complete sample of code to look at, it's impossible
to tell. But the code you posted does not match your assertion about it.
If the code is correct, your assertion is incorrect and you can access the
class simply by specifying the correct namespace for it (or including the
namespace in your "using" section).
Pete
Please try to avoid multiple posting the same theme, it just gets people that
are trying to help frustrated. If you are getting answers, stick to the same
thread.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"tshad" wrote:
I get the following error:
PageInit.cs(43, 71): error CS0246: The type or namespace name 'User' could
not be
found (are you missing a using directive or an assembly reference?)
The error is from the last line in this snippet of code
*************** *************** ***********
using System;
using System.Web;
using System.IO;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.Sess ionState;
using System.Data;
using System.Data.Sql Client;
using System.Collecti ons;
using Microsoft.Visua lBasic;
using MyFunctions;
namespace MyFunctions
{
public class PageInit
{
public static void PageSetup(MyFun ctions.Page thePage)
{
HttpContext.Cur rent.Session["LastPageVisite d"] =
(User)HttpConte xt.Current.Sess ion["User"].LastPageVisite d;
*************** *************** *************** *************** **
I have stored and object "User" in my session variable and am trying to get
access to LastPageVisited . I originally didn't have the (User) in front of
the line and got the error that LastPageVisited didn't exist. So I typecast
the whole string - but got the error:
I have a User Class in the MyFunctions namespace that is in the compiler
line:
C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ csc /t:library PageInit.cs
/r:system.web.dl l /r:system.data.d ll /r:system.dll
/r:Microsoft.Vis ualBasic.dll /r:refresh.dll /r:User.dll
And the User Class is setup like:
*************** *************** *************** ****
using System;
using System.IO;
using System.Data;
using System.Data.Sql Client;
using System.Configur ation;
using System.Collecti ons;
using MyFunctions;
using FtsData;
namespace RolesBasedAuthe ntication
{
[Serializable]
public class User
{
private string lastPageVisited = "";
....
public string LastPageVisited
{
get { return lastPageVisited ; }
set { lastPageVisited = value; }
}
*************** *************** *************** *****
So do I need to change the following line to work?
(User)HttpConte xt.Current.Sess ion["User"].LastPageVisite d;
The problem seems to be the User doesn't exist but it does (doesn't it?).
Thanks,
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Charles Russell |
last post by:
I am setting a three column layout within an existing table. The table
uses previously devloped code so I am force to use it. I have the
following styles defined.
<code><!--Preventative insert so code does not get interpreted by mail
app -->
..c1
{
position:relative;
margin-left:0;
|
by: ThazKool |
last post by:
Is there anyway to write a class or struct that has no storage. It
only operates on a reference to an already existing type.
This is actually an extension to another thread. The thread went a
little off of what I was looking for. Hence this new thread.
Thanks,
ThazKool
|
by: rodchar |
last post by:
Hey all,
I'm trying to understand Master/Detail concepts in VB.NET. If I do a data
adapter fill for both customer and orders from Northwind where should that
dataset live?
What client is responsible for instantiating the orders class? Would it be
the ui layer or the master class in the business layer?
thanks,
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
|
by: Hendrik Schober |
last post by:
Hi,
I have a problem with extending some existing code. In a simplified
form, the problem looks like this:
I have four types, A, B, C, and D. Each A refers to zero, one, or more
B's and each B can be child to zero, one, or more A's. I just call that
"A is a parent of B", and "B is a child of A". The same goes for B and
C and for C and D. So A is only a parent, B and C are both parents and
children, and D is only a child.
| |
by: Christian Kaiser |
last post by:
We have a component that has no window. Well, no window in managed code - it
uses a DLL which itself uses a window, and this is our problem!
When the garbage collector runs and removes our component (created
dynamically by, say, a button click, and then not referenced any more), the
GC runs in a different thread, which prohibits the DLL to destroy its
window, resulting in a GPF when the WndProc of that window is called - the
code is gone...
|
by: kelin,zzf818 |
last post by:
Hi,
Today I read the following sentences, but I can not understand what
does the __init__ method of a class do?
__init__ is called immediately after an instance of the class is
created. It would be tempting but incorrect to call this the
constructor of the class. It's tempting, because it looks like a
constructor (by convention, __init__ is the first method defined for
the class), acts like one (it's the first piece of code executed in...
|
by: jayesah |
last post by:
Hi All,
List and its iterator work as following way :
list<intmylist;
list<int>::iterator itr;
itr = mylist.begin();
cout << (*itr);
But I want something like this:
|
by: Brad Pears |
last post by:
Here is a simple OO design question...
I have a Contract class. The user can either save an existing contract or
they start off fresh with a blank contract, fill in the data and then save a
"new" contract.
I have a method in my contract class called "Save" which is called like
this...
dim oContract as new Contract
|
by: Mousam |
last post by:
Hi All,
First of all forgive me for the length of this post.
I am developing one library for some text editor. In this library
I want to provide a set of C++ classes which will enable client (of
the library) to add tool bars to the text editor. The requirements
are:
-Client can add as many tool bars as he wants to add.
-In each toolbar there will be some tools. Tools can be of button
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |