Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing a html page containing a string of value pairs
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00711769
Message ID:
00711904
Vues:
13
Why don't you just call the ASPX page and pass the information in the URL using the "?"

I didn't realize you had control of the HTML page that you were calling the ASPX page from. The trick is to pass in all the values you need when navigating to the new page. Do this by using the Redirect method of the Response object, as
follows:
Response.Redirect(URLstring)
For the URL string parameter you include the URL and the parameters. If the
URL is http://www.myweb.com/secondpage.htm and you have two parameters named
Param1 and Param2 then you would use the following as the URLstring:
http://www.myweb.com/secondpage.htm?Param1=value&Param2=value
Now, to extract the values on the second page you use the Params collection
of the Request object, as follows:
dim strParam1 as string
dim strParam2 as string
strParam1 = Request.Params("Param1")
strParam2 = Request.Params("Param2")
>Thanks Cathi, I'll give this a shot. By the way, once I've written the code, I'm not sure how to test this out - specifically calling my ASPX page (TestReg.ASPX) from an HTML page containing the following value pairs:
>
>
>sub_id=Tester&author_password=pass&prod_sku=98079949999&qty=1&sh=1&var=1
>
>
>Any advice would be appreciated.
>
>Al
>
>
>
>>Allan,
>>
>>From what I can find, the mshtml.HTMLDocument will provide what you are looking for. You can retrieve the content of the HTML from the body property of the HTML document:
>>
>>
>>Dim doc As mshtml.HTMLDocument = CType(axWebBrowser1.Document, mshtml.HTMLDocument)
>>Dim html AS String = doc.body.innerHTML
>>
>>
>>From there you would read through the string and extract out the data you want to retrieve.
>>
>>
>>>Hi,
>>>
>>>I need to parse an html page that contains a string of value pairs that will be passed to my ASPX page (VB.Net).
>>>
>>>What is the best approach to take considering the following example:
>>>
>>>
>>>sub_id=Tester&author_password=pass&prod_sku=98079949999&qty=1&sh=1&var=1
>>>
>>>
>>>Specifically, using VB.NET, how would I grab, for example, the sub_id("Tester")?
>>>
>>>Thanks in advance, Al
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform