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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:55:12+00:00 2026-06-18T18:55:12+00:00

I am executing a web request using the following: // create http request HttpWebRequest

  • 0

I am executing a web request using the following:

            // create http request
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            // set user agent
            req.UserAgent = "Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0";
            req.AllowAutoRedirect = true;
            req.MaximumAutomaticRedirections = 3;
            // retrieve response
            HttpWebResponse rep = (HttpWebResponse)req.GetResponse();
            HttpStatusCode  stc = rep.StatusCode;

On some URLs, but not all, the status returns OK with -1 content length, but if I use Firefox directly it renders.

Is there a setting that I need to provide to C#? Sample link http://www.cbsstore.com/detail.php?p=382214&ecid=5511&pa=CSE-FGL&CAWELAID=1599172025

  • 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-18T18:55:13+00:00Added an answer on June 18, 2026 at 6:55 pm

    If you’re getting the content length from HttpWebResponse.ContentLength, a value of -1 doesn’t mean there’s no content – it means “keep reading until you get to the end of the stream” (because the Content-Length header hasn’t been set). A content length of zero would mean no content.

    Basically, if you want to see the content, you should actually try to read it 🙂

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

Sidebar

Related Questions

HI, I am using the following code request.js var request; function runAjax(JSONstring) { //
Using the ksoap2 library (v2.6.4), SOAP version11, I'm executing a web service via a
I am new to Web Crawling , and I am using HttpWebRequest to crawl
I am following http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files . Using VS2010, ASP.NET 4.0, MVC3 in C# with ADO.NET
The issue is as follows, I am using an HttpWebRequest to request some online
Suppose I have the following (rather common) model Client invokes web service request ->
When executing an ajax request using jQuery I am not sure how to add
Description: An unhandled exception occurred during the execution of the current web request. Please
I'm trying to load a local web page executing: var html = document.open('google.html'); document.documentElement.innerHTML
Having a problem executing a Python script from a .NET web service. The web

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.