473,378 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Is this possible with .NET

Hi,
I am tasked with a small project. I have to create an app that can login to a website, navigate to a page from their menu, then on the popup page, select an item, on the next popup, grab the data I am looking for and verify if with our system.

I have to validate some information I have in our system with one of our suppliers. So e.g for items A, B and C I need to verify their quantity amount on their website.

Where can I find some information on doing this or can someone just provide me a short sample to get started?

Thanks
Aug 29 '07 #1
3 1402
phvfl
173 Expert 100+
Hi,

This would be possible, but quite involved.

The method that you would be using would be to send a http request to your supplier's website and parsing the reply. This would probably involve multiple requests unless it is possible to attach a cookie to the request that signals that you are logged in.

You may wish to contact your supplier to find out if they offer an system for making automated enquiries such as this, such as a web service. Many companies would frown on automated requests such as this as it could enable you to make a massive number of automated requests to their site which could affect the performance of their site.
Aug 29 '07 #2
Yes, I have done the same thing in a previous project.

This http post class and the SGMLreader (html to xml, get it while its still being hosted here) will be your best friends.

You can find a few articles on the net on using the SGMLreader.
I used it to do xpath queries to get the data I needed from the http response.
I used Visual Xpath to create the queries for me.

Its going to take a while to get everything to work right and your going to spend alot of time in the debugger. If the site your going to do this to uses cookies, get back to me and ill save you a good 10 hours of hair pulling.
Aug 30 '07 #3
here is a small sample of code you will be using
Expand|Select|Wrap|Line Numbers
  1. //send our post to a asp.net url
  2. PostSubmitter post = new PostSubmitter();
  3. post.Type = PostSubmitter.PostTypeEnum.Post;
  4. post.Url = url;
  5.  
  6. post.PostItems.Add("TextBox1", _userName);
  7. post.PostItems.Add("TextBox2", _password);
  8. post.PostItems.Add("__EVENTTARGET", "Command1");
  9. post.PostItems.Add("__EVENTARGUMENT", "");
  10. post.PostItems.Add("__ET", "");
  11. httpResponse = post.Post();
  12.  
  13. //turn the html into a xml doc we can query
  14.         SgmlReader reader = new SgmlReader();
  15.         reader.DocType = "HTML";
  16.         StreamReader sReader = new StreamReader(httpResponse.GetResponseStream());
  17.         reader.InputStream = new StringReader(sReader.ReadToEnd());
  18.  
  19.  
  20.         StringWriter sw = new StringWriter();
  21.         XmlTextWriter writer = new XmlTextWriter(sw);
  22.         writer.Formatting = Formatting.Indented;
  23.         while (reader.Read())
  24.         {
  25.             if (reader.NodeType != XmlNodeType.Whitespace)
  26.             {
  27.                 writer.WriteNode(reader, true);
  28.             }
  29.         }
  30.  
  31.         response = sw.ToString();
  32.  
  33.         XmlDocument xdoc = new XmlDocument();
  34. //be sure to use debugger here to save xml to file for use with visual xpath
  35.         xdoc.LoadXml(sw.ToString());
  36.  
  37.         //select some of the data from one of the html elements on the page
  38.         StringBuilder sbAction = new StringBuilder();
  39.         XPathNavigator navAction = xdoc.CreateNavigator();
  40.         XPathNodeIterator nodesAction = navAction.Select("/html/body/form/@action");
  41.         while (nodesAction.MoveNext())
  42.         {
  43.             sbAction.Append(nodesAction.Current.Value + "\n");
  44.         }
Aug 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Julia Briggs | last post by:
I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping...
36
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
7
by: Andrzej | last post by:
Is it possible to call a function which name is given by a string? Let assume that I created a program which call some functions for example void f1(void), void f2(void), void f3(void). ...
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
1
by: AAA | last post by:
hi, I'll explain fastly the program that i'm doing.. the computer asks me to enter the cardinal of a set X ( called "dimX" type integer)where X is a table of one dimension and then to fill it...
25
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
4
by: RSH | last post by:
Okay my math skills aren't waht they used to be... With that being said what Im trying to do is create a matrix that given x number of columns, and y number of possible values i want to generate...
7
by: Robert S. | last post by:
Searching some time now for documents on this but still did not find anything about it: Is it possible to replace the entry screen of MS Office Access 2007 - that one presenting that default...
14
by: bjorklund.emil | last post by:
Hello pythonistas. I'm a newbie to pretty much both programming and Python. I have a task that involves writing a test script for every possible combination of preference settings for a software...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.