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 7760813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:59:19+00:00 2026-06-01T13:59:19+00:00

I am writing a wrapper library for log4net. This library should be able to

  • 0

I am writing a wrapper library for log4net. This library should be able to capture Context information such as querystring, cookie, form fields etc. etc.

I am invoking this wrapper class from Console application as opposed to TDD class.

Is there a way to populate HttpContext object inside a Console application as follows?

HttpContext c = new HttpContext(null);
c.Request.QueryString.Keys[1] = "city";
c.Request.QueryString[1] = "Los Angeles";
c.Request.QueryString.Keys[2] = "state";
c.Request.QueryString[2] = "CA";

And then retrieve it as follows?

Console.WriteLine(context.Request.QueryString.Keys[1]);

I am getting the following exception when I attempt the above code.

Property or indexer 'System.Collections.Specialized.NameObjectCollectionBase.KeysCollection.this[int]' cannot be assigned to -- it is read only 
  • 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-06-01T13:59:21+00:00Added an answer on June 1, 2026 at 1:59 pm

    you can read here on using Moq to fake it out:
    http://o2platform.wordpress.com/2011/04/05/mocking-httpcontext-httprequest-and-httpresponse-for-unittests-using-moq/

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

Sidebar

Related Questions

I'm writing a wrapper around a C library in Objective-C. The library allows me
I'm writing a Python wrapper for a C++ library, and I'm getting a really
I am writing a library that creates multiple elements inside a wrapper element, and
I'm writing a DLL wrapper for my C++ library, to be called from C#.
I am writing a C# wrapper for a 3rd party library that reads both
I'm writing a .NET 4.0 library that should be efficient and simple to use.
I'm currently writing a wrapper library for windows mobile in C/C++. I have to
I'm writing a small wrapper for a C library in Python with Ctypes, and
I'm writing a wrapper around a class library that I have no control over.
I'm writing a Clojure wrapper for the Braintree Java library to provide a more

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.