Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a problem to login website from windows application. After login in website need to download attachment of the website orders.

What I have tried:

I have tried to browse the link but unable to pass username and password to the website to login on website and read website code.
Posted
Updated 27-Sep-18 7:05am
Comments
Richard MacCutchan 27-Sep-18 11:33am    
Maybe they don't want you to login and steal their information.
Patel Shailendra 27-Sep-18 11:36am    
We are doing their data entry job in that cases we have login details for the website. We want to download attachments automatically instead of manual work.
Richard MacCutchan 27-Sep-18 12:41pm    
Well you need to provide much more information if you want help on this. Web scraping is not excessively complicated, but you must emulate a real user entering the details. Maybe a Google search for web scraping will get you some useful sample code.
Afzaal Ahmad Zeeshan 27-Sep-18 11:41am    
Do they have an API that you will be using?
Patel Shailendra 27-Sep-18 11:43am    
No, We don't want to inform client that we are using some automate work.

1 solution

In this problem of yours, a very easier way would be if there can be found some of their APIs or libraries that can let you do this.

But since you do not intend to use, or perhaps the service does not expose an API, the only way to do this is using an external library that will allow you to parse and validate the HTML response that you get back. For example, HtmlAgilityPack[^] is one of such libraries that I used to consume in my own apps back in the days. Use this library to work around with the HTML pages, and send new requests, get responses for the pages.

HttpClient Class (System.Net.Http) | Microsoft Docs[^]

One problem with this is, that your HTTP clients might not be able to send the HTTP cookies, please see this link to find out how your cookies would be shared by a real browser, How are cookies passed in the HTTP protocol? - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900