Solved

Save as via code

Posted on 2013-12-17
8
273 Views
Last Modified: 2014-01-30
Hi Experts,

I have page with a 10 hyperlinks. I would need to process this page and click via code each link as right click and do Save As html page.

Thanks.
0
Comment
Question by:fpoyavo
  • 4
  • 4
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39726867
What type of application are you working with?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39726990
C# windows form which reads html file or if you can give jquery one to do right on the web form would be great.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39727019
Are you using the WebBrowser control with your Windows Forms application?
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 1

Author Comment

by:fpoyavo
ID: 39727089
Lets just stick to windows app reading html file. That's easier I think.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39727094
That last statement is confusing.  What would you like to do after reading the HTML file?
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39727235
Nothing is confusing :))) Just get links from HTML by reading it and do saveas ...can you show how it looks in code ?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39727256
Nothing is confusing for you, because you understand your environment ;)

You can use the HTML Agility Pack to parse HTML.  It is available as a Nuget package.

Here is an example of parsing for anchors:

public void ParseHtml(string url)
{
    var document = new HtmlDocument();
    document.LoadHtml(url);

    var node = document.DocumentNode;    

    var anchorList = node.SelectNodes("//b/a[@href]"); 

    foreach (var anchor in anchorList)
    {
        var href = anchor.Href;
    }
}

Open in new window

0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39727340
hi,

Looks good. Let me try.

Thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MYSQL responding very slow 3 48
reading excel file in .net 2 30
pressing download button in c# 7 34
VB.net Filesystem watcher not working 5 31
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question