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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:07:20+00:00 2026-06-14T00:07:20+00:00

This is what I have so far but I’m running into an issue. The

  • 0

This is what I have so far but I’m running into an issue.

The page https://xxxxxxxx.zendesk.com/tickets/33126 contains a link to a .jpg image. I want to download this image. The page could have several images so I need to scan the page to find all the .jpg, .gif, etc.

I'm having an issue with my code at the end. I'll explain there.

    public static void GetTicketAttachments(string url)
    {   
        GetImages("https://xxxxxxxx.zendesk.com/tickets/33126");   
    }

static void GetImages(string url)
    {
        string responseString;
        HttpWebRequest initialRequest = (HttpWebRequest)WebRequest.Create(url);
        using (HttpWebResponse initialResponse = (HttpWebResponse)initialRequest.GetResponse())
        {
            using (StreamReader reader = new StreamReader(initialResponse.GetResponseStream()))
            {
                responseString = reader.ReadToEnd();
            }

            List<string> imageset = new List<string>();
            Regex regex = new Regex(@"f=""[^""]*jpg|bmp|tif|gif|png", RegexOptions.IgnoreCase);
            foreach (Match m in regex.Matches(responseString))
            {
                if (!imageset.Contains(m.Value))
                    imageset.Add(m.Value);
            }
            for (int i = 0; i < imageset.Count; i++)
                imageset[i] = imageset[i].Remove(0, 3);
            totalFiles = imageset.Count;
            currentFiles = totalFiles;

            foreach (string f in imageset)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(DownloadImage), f);
            }
        }
    }

The issue happens here. The object “path” is always null for some reason. Therefore I cannot download the picture.

static void DownloadImage(object path)
    {
        currentFiles--;
        path = Path.GetFileName(path.ToString());
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path.ToString());
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
            Image image = Image.FromStream(response.GetResponseStream());
            image.Save(@"C:\" + Path.GetFileName(path.ToString()));
        }
    }

Anyone know what could be the issue? The “picture count” is indeed counting 1 (one link TO a picture on the page).

  • 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-14T00:07:21+00:00Added an answer on June 14, 2026 at 12:07 am

    Don’t try and parse the document yourself. Take a look at the HTML Agility Pack ( http://htmlagilitypack.codeplex.com/ ) to extract meaningful information from HTML documents.

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

Sidebar

Related Questions

I have this so far but the Column 'name' is ambiguous, so I want
I have this so far but I don't know how to write over the
Ok, this is what I have so far - but it gives me an
I have this code so far which perfectly but relies on there being a
I am pretty new to this iPhone dev thing but so far I have
This has / may have been asked before, but, as far as I remember,
This is a very lame question, but I have struggled with it far too
Trying to compare voids for a sorting algorithm. I have this so far but
This is what I have tried so far but with no success: std::string ReadPartial(
I have this so far: http://jsfiddle.net/u5vhS/54/ . What I want to be able to

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.