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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:31:25+00:00 2026-05-28T03:31:25+00:00

I tried to perform a POST using a HttpWebRequest instance to a web url

  • 0

I tried to perform a POST using a HttpWebRequest instance to a web url that requires an authentication (an ASP.NET MV3 standart [Authorize] decorated action method with build-in membership system), but providing login and passowrd as NetworkCredentials in HttpWebRequest didn’t do the trick.

I ended up using a global CookieContainer and two HttpWebRequests:

  1. Set a request’s CookieContainer to globalCookieContainer.
  2. POST username and password to a logon URL. (after that step the container still reports the Cookie count is 0).
  3. Create another HttpWebRequest instance and set the globalCookieContainer to request’s CoockieContainer.
  4. POST to a final url that requires authentication. For some reason, this time second request object provides the cookies as a part of a request and it goes through.

An entire “magic” of cookie management isn’t discribed anywhere well (I really tried to search around).

We’ve got this scenario covered. But in what cases HttpWebRequest.Credentials should be used?

  • 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-28T03:31:26+00:00Added an answer on May 28, 2026 at 3:31 am

    HttpWebRequest.Credentials is meant to be used when the authentication is performed through one of the schemes in the AuthenticationSchemes enum. Among others, this includes Basic and Digest HTTP auth, NTLM and Kerberos.

    That said, you can cook up your own custom authentication schemes by deriving from NetworkCredential on the client side and implementing IAuthenticationModule on the server side.

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

Sidebar

Related Questions

I tried searching, but did not find a specific post that could answer my
I'm using jqGrid in an ASP.NET MVC webapp. When the page first loads, the
I have a asp.net 2.0 web app which calls a long running stored proc
I have a couple of functions that perform HTTP POST/GET/HEAD requests. For the POST
I currently have a form that I am trying to perform a post on
I have an ASP.NET web app where I use an ado sql connection to
I need to perform some action when my application receives focus. I've tried hooking
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
I am trying to post to a REST service using PHP cURL but I'm
All, While this is similar to another post , that post (does not indicate

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.