|
-
Sep 30th, 2007, 01:30 AM
#1
Thread Starter
Lively Member
Find username in downloaded HTML
OK. So what I am trying to do is this, its something basic, but i cant do it.
I have a web browser, its invisible, it then logs on using the details in the options of the program, it then downloads the HTML into a textbox(multiline).
There is a small line of code in the HTML that displays the users name, however depending on who logged in, the name can be different. I want to know, how do a search through this mass amount of text and only get the small text "Welcome, ****" (where **** = a name)
I thought that maybe i could find out the position of the start of the "Welcome," then find the position of the "&nsb" after the users name, then subtract both numbers, and there is the number for the TextBox1.SelectionLength
Please help me, i have this idea, but i am new to .net and i have no idea what to do 
Thank you
-
Sep 30th, 2007, 02:56 AM
#2
Re: Find username in downloaded HTML
Don't use hidden controls like that. If you want the source of a Web page then create a WebClient object and call its DownloadString method. Once you have the HTML source in a String you can manipulate it using methods of the String class, like Substring and IndexOf, or you can perform pattern matching using regular expressions. There would be numerous examples of using a Regex to find HTML tags already posted on the forum.
-
Oct 1st, 2007, 05:27 PM
#3
Thread Starter
Lively Member
Re: Find username in downloaded HTML
the only problem with this is that i need to log in?? how do i do that with a WebClient object? Can this be done?
-
Oct 1st, 2007, 05:53 PM
#4
Re: Find username in downloaded HTML
Have you read the documentation for the WebClient class? I'm guessing not. Do so and you'll have your answer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|