views:

27

answers:

1

I have an asp.net webpage that only contains a textbox and a button. The user submits their email address using this webpage.

What I am trying to do now is take the information submitted by the user and go to another website. Where my "website/program" gives the different website the entered email address, and clicks the submit button.

If I where to physically go to the different website, there would be a textbox to enter the email. But since I am accessing the website from my page "behind the scenes" I cant manually enter their email address...

Is it possible to do this, if so how? Also, my code behind is in VB.

Thanks!

A: 

Well it can be done, but the simpllicity of it depends on what this other webpage is. Will this webpage always be the same or can it change?

If it a dynamic website that will frequently change, then you will need to basically parse the html and emulate how the email address gets posted to the webpage. Look for the tag in the html and see what page it posts to.

What you want to do is use HttpWebRequest. This class can send information to another web page. Here is a tutorial on how to do what you are asking: http://www.jigar.net/howdoi/viewhtmlcontent106.aspx

And here is the MSDN documentation on it: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(VS.71).aspx

Keep in mind that my solution will work if the web site is using POST or GET, but some sites use Javascript. To do this, it will require you to build a javascript interpreter.

icemanind
I know for a fact this website uses post. So this should be very helpful! I have recieved information about HTTPwebrequest before from other people. I am still a little unsure on how to use it though.
Johnny Whisman
After reviewing the example code I am still far confused... The website I am trying to post to is no way affiliated with me. I dont know what their codebehind looks like. All I know is they have a textbox that wants an email address... I want to "enter the emailaddress in that texbox" without physically going to the website.
Johnny Whisman
What you need to do is go to this website and view the source (if using IE, just right click on the page and go to view source). You need to look for where the form tag begin and any <input> tags in between the form tags are fields that need to be passed. Check this site out: http://www.worldofasp.net/tut/WebRequest/Working_with_HttpWebRequest_and_HttpWebResponse_in_ASPNET_114.aspx
icemanind