Jump to content

"classic" (i.e. Old) Asp Question


Recommended Posts

Posted

Hi

I'm trying to write some code that allows my colleagues to fill in a brokers booking page with customers' details from within a browser. For example, I have a browser split into two vertical frames - the left side holds our customers details (name, email address etc.) and the right frame holds the brokers booking page. I want to be able to populate the right frame form fields with the data from the left frame with as few key strokes as possible.

This is easy enough using VisualBasic (which I've done for use in the office) as I can interrogate the HTML code in the VB browser and fill the fields in from our database. I would like to be able to create a browser version of this so that urgent bookings can be made via a PDA.

I was wondering if anyone had come across anything similar using ASP.?

Guess it cannot be done but I thought that I'd ask.

Cheers

Mick

Posted (edited)

It can be done .... I am sure. With Dreamweaver, Ajax and a little bit of coding you can make a gallery where if you click on a thumbnail on one side, the full picture comes up on the other side. No frames needed.

Too complex though to get into details though ...

Search ....

Edited by sniffdog
Posted

What version of Visual Basic are you using? If you are using VB.NET this can be done fairly easily with ASP.NET, but personally I would not use frames in the interface because it complicates things considerably. Similar effects can be created using DIV tags and CSS.

Posted

Thanks for the replies.

I'm using VB6 in the office for the administration system. I haven't really gotten into VB.NET/ASP.NET (know of anywhere in Bangkok where I can pay for some training?).

I'm using frames as the left frame is our site and the site in the right frame doesn't belong to us.

I found a not so clean work around in ASP. In IE I can put a button next to a text box that, when clicked, copies the contents of the text box to the clipboard then it's just a matter of pasting the clipboard into our brokers' site.

Have to get some training in VB.NET - ideas anyone?

Thanks

Mick

Posted

Well, I don't know where you can get VB.NET training in Bangkok, but I might be able to point the way how to solve this issue with ASP.NET.

The way I would handle a scenario like this is to build a parser to load the fields you are interested in into an object and then allow the user to load the data from the object as default values into your form. Then they can just submit the form back to save the data in your datastore.

In ASP.NET it is a pretty simple operation to get the text output of a web site using the WebRequest and WebResponse objects (in the System.Net namespace). Here is a code sample how to do it.

'Gets the output of a webpage as utf-8 encoded text

Public Function GetUrlOutput(ByVal url As String) As String

Dim wr As WebRequest = WebRequest.Create(url)

Dim resp As WebResponse

Try

'Get the page

resp = wr.GetResponse

Try

'Return resp.GetResponseStream.ToString

Dim reader As New StreamReader(resp.GetResponseStream, System.Text.Encoding.UTF8)

Return reader.ReadToEnd

Finally

resp.Close()

End Try

Catch ex As System.Net.WebException

'This will trap any nonresponsive page so we

'can safely ignore it

Return ex.Message

End Try

End Function

This function just returns the raw HTML from a given URL. From there, I would use regular expressions to parse out the fields I am interested in, but some people find regular expressions a bit difficult to adjust to. There is no reason why you couldn't just manually create parsing code in VB though. Either way, you will need to make changes to your code when the 3rd party website changes.

Another route you might try is to see if the owner of the website has or would be willing to create an XML web service to supply the data to you. This of course depends on the specific type of relationship you have with the owner of that website.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...