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

  • SEARCH
  • Home
  • 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 8442451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:50:44+00:00 2026-06-10T08:50:44+00:00

So a request is made to an ASP.net MVC controller/action. This has an associated

  • 0

So a request is made to an ASP.net MVC controller/action. This has an associated session. Part of the action we instantiate a WebClient object and make a call to a resource that is on the same site.

However, despite the fact that it is the same site, same app pool, because the WebClient creates a new request it has a different session. (I know what your thinking, if it is on the same app pool, same site, why need the WebClient). I have left those details out to not muddy the water, but there is a reason for the WebClient.

It is my understanding, that if the WebClient could be assigned the cookies from original Request.Cookies collection, that ASP.net would be able to look up the existing Session based on the cookies existing.

So I guess there is 2 questions:

  1. Is this correct, and if I was to assign the cookies (somehow) to the WebClient that the Request created by the WebClient would end up acquiring the Session of the original request.
  2. How can I assign the current Request.Cookies to the WebClient?

UPDATE

I have looked at and tried both Using CookieContainer with WebClient class as well as Sending cookies using HttpCookieCollection and CookieContainer and I have not found a working solution.

We have a bundled Solution of Umbraco and asp.net MVC and we are using the webclient to make a request to Umbraco for a page. In my research I have also discovered that there could be other facts that might cause the cookies not to work as I described above. So I guess the first order of business it to find out if the whole bit about cookies would allow the original session to be obtained? Or if there is a better way to go about what we are doing?

  • 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-10T08:50:45+00:00Added an answer on June 10, 2026 at 8:50 am

    Maybe you can try the implementation shown here:

    Sending cookies using HttpCookieCollection and CookieContainer

    It copies the incoming cookies to an outgoing external request.
    However, that implementation is for using HttpWebRequest. If you really need to use WebClient instead then this might be useful:
    Using CookieContainer with WebClient class

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

Sidebar

Related Questions

I'd like to detect requests made by my Silverlight client in ASP.Net MVC. Silverlight
I have an ASP.NET MVC 2 application which in part allows a user to
Hi, I have built a ASP.NET MVC website that uses Membership, this works fine.
Im working on a web project in ASP .NET MVC 2. In this project
Our (asp.net) system is part of a larger system. It is launched via this
In ASP.NET MVC, there is a useful method Request.IsAjaxRequest that I can use to
I have made a MVC application that uses the built-in ASP.NET login functions. It
We employ Out-of-Process SQL Session State, ASP.NET 3.5 MVC 1.0 and Forms Authentication using
I have made a webusercontrol on my asp.net webforms application. But I get this
I have made a Azure web app that has a ASP.NET web that also

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.