Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6197193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:46:35+00:00 2026-05-24T03:46:35+00:00

I have an asp.net project that’s compiled on a server. On that same server

  • 0

I have an asp.net project that’s compiled on a server. On that same server I have a windows service that’s running methods referenced from the asp.net .dll.

Everything works fine except for when the httpcontext.current object needs to be accessed.

I’m fairly certain that the cause of the .current being null is that it’s referencing the shared library without an actual instance of the site running. In a previous version of the service I was able to find a workaround in asp.net by not using the context, however that is now a last resort as much of the architecture of the site has changed.

Is there anyway to create an instance of the site and simulate a current httpcontext for the purposes of the service?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:46:36+00:00Added an answer on May 24, 2026 at 3:46 am

    The ASP.NET framework instantiates and manages the HTTP context and outside of ASP.NET, this will always be null. You’d have to dig into the framework to figure out how to create it, but honestly, it wouldn’t be worth it…

    However, could you reconfigure your HttpContext references to point to HTTpcontextbase? If you did, HttpContextBase is a base class and can be inherited by anyone. Very easily, you could create a custom one to achieve what you want. You can even create your own static to wrap HttpContext.Current, refer to this static in the app, and to this static in the service (but have the service initially instantiate it).

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a mid-sized asp.net project that we just promoted from our dev server
I have an asp.net mvc project that uses some search methods in a seperate
I have an asp.net web project that references a domain project. From within the
We have an ASP.Net MVC project that will start with a single web server
I have PDF that I would like to open from ASP.net project. I don't
I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the
I have a UserControl in my Asp.net project that has a public property. I
In visual studio, I have an asp.net 3.5 project that is using MS Enterprise
I have an ASP.NET MVC project and I have a single action that accepts
I have an ASP.NET MVC project with a form. In the Action method that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.