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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:44:46+00:00 2026-06-06T04:44:46+00:00

Right now I have a foreach loop that grabs the first link with an

  • 0

Right now I have a foreach loop that grabs the first link with an img tag.

I want to be able to edit this link I get and then put it in a request.

For example say I get back “http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif” and I only want to keep the “p-c1rF4kxgLUzNc” part and then put that into a new url in a httprequest.

The link would be random so I can’t simply just put a static url, I want the one the list gets.

List<string> imgtags = new List<string>();

foreach(HtmlNode link in doc.DocumentNode.SelectNodes("//img[@src]"))
{
    HtmlAttribute att = link.Attributes["src"];
    imgtags.Add(att.Value);
    break;
}

//edit the url the list gets

HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("http://google.com/" + *editedurl*);
  • 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-06T04:44:47+00:00Added an answer on June 6, 2026 at 4:44 am

    This probably isnt the best way of doing it, but you could do a split on the original link, something like this:

      var link = originalLink.split('/');
    

    Then you could work out which the last element of the link array is and do a split on that as well. I am using 7 as an example here.

      var newLink = link[7].split('.');
    

    Then you would just need to use newLink[0] and you would have the name that you wanted.

    As i say this isnt a pretty way of doing it, but its a workaround if you dont get any better answers.

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

Sidebar

Related Questions

Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
I have a multi-dimensional array right now that looks like this: function art_appreciation_feeds() {
Right now I have this SQL query which is valid but always times out:
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
Right now i have a line of code, in vb, that calls a text
I have a method right now that loops through a list of business objects
Right now, i am reading in an array and doing a foreach loop on
Suppose I have some code that looks like this: foreach(type x in list y)
Good day! I right now have a function the drags an element from a
Right now I have def min(array,starting,ending) minimum = starting for i in starting+1 ..ending

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.