473,594 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No context for HttpContext in class

KJS
This is a C# web app.

The Object HTTPContext is not available in my class. I need to grab an
instance of the Current context with something like:

HTTPContext c = HTTPContext.Cur rent;

The problem is, HTTPContext is not available to my intellisence, even
though I have System.Web above. This is a class object which a web
class form would be utilizing, but am stuck with no context (no
intellisence).

Any idea what might be wrong?
Dec 21 '05 #1
3 2295
KJS
Ok, let me throw out an important piece: the class which I need the
current context is of another project. So I have somthing like:

mySolution
webAppProject
default.cs
myUtilitiesProj ect
myXMLParser.cs
myDatabaseClass .cs

So, I need Current context across projects. Is this possible?

Karl..
In article <MP************ ************@ne ws.cox.net>,
ka***********@h otmail.com says...
This is a C# web app.

The Object HTTPContext is not available in my class. I need to grab an
instance of the Current context with something like:

HTTPContext c = HTTPContext.Cur rent;

The problem is, HTTPContext is not available to my intellisence, even
though I have System.Web above. This is a class object which a web
class form would be utilizing, but am stuck with no context (no
intellisence).

Any idea what might be wrong?

Dec 21 '05 #2
KJS
This is a big fat NEVERMIND! I figured it out, just needed to add the
reference to the project for System.Web.DLL

Dohhh!

(maybe this helps someone else)

In article <MP************ ************@ne ws.cox.net>,
ka***********@h otmail.com says...
Ok, let me throw out an important piece: the class which I need the
current context is of another project. So I have somthing like:

mySolution
webAppProject
default.cs
myUtilitiesProj ect
myXMLParser.cs
myDatabaseClass .cs

So, I need Current context across projects. Is this possible?

Karl..
In article <MP************ ************@ne ws.cox.net>,
ka***********@h otmail.com says...
This is a C# web app.

The Object HTTPContext is not available in my class. I need to grab an
instance of the Current context with something like:

HTTPContext c = HTTPContext.Cur rent;

The problem is, HTTPContext is not available to my intellisence, even
though I have System.Web above. This is a class object which a web
class form would be utilizing, but am stuck with no context (no
intellisence).

Any idea what might be wrong?

Dec 21 '05 #3
hi,

nice monologue :)

glad you find the solution though.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"KJS" <ka***********@ hotmail.com> wrote in message
news:MP******** *************** *@news.cox.net. ..
This is a big fat NEVERMIND! I figured it out, just needed to add the
reference to the project for System.Web.DLL

Dohhh!

(maybe this helps someone else)

In article <MP************ ************@ne ws.cox.net>,
ka***********@h otmail.com says...
Ok, let me throw out an important piece: the class which I need the
current context is of another project. So I have somthing like:

mySolution
webAppProject
default.cs
myUtilitiesProj ect
myXMLParser.cs
myDatabaseClass .cs

So, I need Current context across projects. Is this possible?

Karl..
In article <MP************ ************@ne ws.cox.net>,
ka***********@h otmail.com says...
> This is a C# web app.
>
> The Object HTTPContext is not available in my class. I need to grab an
> instance of the Current context with something like:
>
> HTTPContext c = HTTPContext.Cur rent;
>
> The problem is, HTTPContext is not available to my intellisence, even
> though I have System.Web above. This is a class object which a web
> class form would be utilizing, but am stuck with no context (no
> intellisence).
>
> Any idea what might be wrong?
>

Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2052
by: Srini | last post by:
I am implementing Front Controller in ASP.net as outlined in Microsoft documentation titled "Implementing Front Controller in ASP.NET Using HTTPHandler" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp Everything works well except for context.server.transfer(string url) method (refer to RedirectingCommand.cs class in the above documentation) Here are the error details Server...
0
1194
by: Michael McDaniel | last post by:
I have overridden HttpApplication in my class library. When my application starts, There are configuration files that I need to load in order for my application to work correctly. This works great, however, I now have a config file that I need that is located on a virtual mapped path within iis. During my HtppApplication load, I have no HttpContext, hence my problem. How do I map a path when I have no Current Context?
3
1879
by: Seth | last post by:
I have been trying to create a mock httpcontext for the purpose of unit testing. I have a class, Customer, that uses cookies. I have set it up to be able to take a httpcontext as a parameter in an overloaded constructor. I have seen a few references to people that have created mock httpcontexts but I can not seem to get it to work. This is what I have right now, it is the result of working backwards from httpcontext and trial and...
5
3065
by: | last post by:
Hoping someone can help with a simple but puzzling problem. I have some code that I want to build as a class method. The code works fine when I embed it in Page_Load. But when I try to generalize the code into the method of a class I am trying to build, it gives me strange errors: "CS0103: The name 'Server' does not exist in the current context". (Server being a call to Server.MapPath.) I'm working in ASP.NET 2.0 and VS.NET 2005. ...
2
1353
by: Jimbo | last post by:
Hey Have a real problem here. I have a page that consists of a lot of div tags and everything on the page is made in controls. In one of the controls we call a method in another class that produces some XML, In the end of that method we call transform to render the xml ive built up in .net into HTML from the xsl stylesheet. The output is
2
3953
by: nalbayo | last post by:
what's the difference between HttpContext.Current.User.Identity.Name; and Context.User.Identity.Name; thanks!
1
2579
by: Greg Hurlman | last post by:
I have an HttpModule that captures the FormsAuthenticationModule.Authenticate event, and replaces the HttpContext principal with a custom principal. The code is straightforward enough, yet when an ASPX page tries to get this custom principal it fails - the object I inserted is not there. I've tried having this module declaration at both the top & bottom of the list in my web.config... What am I missing? The code:
0
2426
by: Daniel Meier | last post by:
Hi I'm using a custom PageHandlerFactory as it's used in Microsofts p&p WebClient Software Factory. The problem is, that I cannot use Sessions now; HttpContext.Current.Session is null. When I use the standard PageHandlerFactory instead, all works fine. What do I have to do, to enable SessionState with my custom PageHandlerFactory?
8
29797
by: rn5a | last post by:
I have a user control named Enter.ascx which has 2 TextBoxes. The 2 TextBoxes are named txt1 & txt2. The entire logic of this user control (like the properties of the 2 TextBoxes using set/get etc.) is encapsulated in a code behind page named Enter.ascx.vb. The code-behind also creates TextChanged events for the 2 TextBoxes. This is the code in Enter.ascx.vb: Namespace Details Public Class EnterCB : Inherits UserControl Public...
0
7936
marktang
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...
0
7874
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,...
0
8366
jinu1996
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...
1
7997
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,...
1
5738
isladogs
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...
0
5402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.