473,379 Members | 1,326 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,379 software developers and data experts.

http post to another website

I am developing an application which will allow me to automatically sign into
an external website. I can currently do a screen scrape using
HTTPWEBREQUEST. However I want to just redirect to the external site. No
need to pull back any data.

Here is the code I am using.

Dim encoding As ASCIIEncoding = New ASCIIEncoding
Dim myParams As String = "AccessID=" & sUserID & "&Password=" &
sPassword
Dim data As Byte() = encoding.GetBytes(myParams)
Dim LOGIN_URL As String =
"https://www.blahblan.com/blah/blah.asp?WCE=RemoteLogon&IRL=T"

Dim WebRequest As HttpWebRequest =
CType(WebRequest.Create(LOGIN_URL), HttpWebRequest)
WebRequest.Method = "POST"
WebRequest.ContentLength = myParams.Length
WebRequest.ContentType = "application/x-www-form-urlencoded"

Dim myWriter As StreamWriter = New
StreamWriter(WebRequest.GetRequestStream())
myWriter.Write(myParams)
myWriter.Close()

At that point I would usually pull back the responsestream, but now I just
want to redirect to that website. I have tried appending the paramaters to
url to create a querystring, but that does not seem to work. I don't know
why as I don't have control over the external application.

Any thoughts?
Thanks
--
Tyler
Jun 13 '06 #1
5 2417
Thus wrote Tyler,
I am developing an application which will allow me to automatically
sign into an external website. I can currently do a screen scrape
using HTTPWEBREQUEST. However I want to just redirect to the external
site. No need to pull back any data.

Here is the code I am using.

Dim encoding As ASCIIEncoding = New ASCIIEncoding
Dim myParams As String = "AccessID=" & sUserID & "&Password="
&
sPassword
Dim data As Byte() = encoding.GetBytes(myParams)
Dim LOGIN_URL As String =
"https://www.blahblan.com/blah/blah.asp?WCE=RemoteLogon&IRL=T"
Dim WebRequest As HttpWebRequest =
CType(WebRequest.Create(LOGIN_URL), HttpWebRequest)
WebRequest.Method = "POST"
WebRequest.ContentLength = myParams.Length
WebRequest.ContentType = "application/x-www-form-urlencoded"
Dim myWriter As StreamWriter = New
StreamWriter(WebRequest.GetRequestStream())
myWriter.Write(myParams)
myWriter.Close()
At that point I would usually pull back the responsestream, but now I
just want to redirect to that website. I have tried appending the
paramaters to url to create a querystring, but that does not seem to
work. I don't know why as I don't have control over the external
application.


I don't quite get what you're trying to achieve. A redirect is always issued
by the server side. On the client side, all you can do is follow the redirect
or remain stuck where you are.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jun 13 '06 #2
Simply put, I am trying to logon to a website. I have a url, a username, and
a password. Normally I would put that data in a querystring like so:
https://www.blahblan.com/blah/blah.a...e=x;password=x

That will not work for some reason. I don't have any control over the
recieving website. However when I try a screen scrape as before (writing the
parameters to a streamwriter), I can login and pull back the html from that
site.

Instead of a screen scrape I want to simply send the user to the new
website.

With the data I have in hand, I would like to "redirect" the user to the new
website without using a querystring, but passing the variables along to
automatically login.

Am I making sense? If not please let me know and I will try and clarify
further.

Thanks for your help.
--
Tyler
"Joerg Jooss" wrote:
Thus wrote Tyler,
I am developing an application which will allow me to automatically
sign into an external website. I can currently do a screen scrape
using HTTPWEBREQUEST. However I want to just redirect to the external
site. No need to pull back any data.

Here is the code I am using.

Dim encoding As ASCIIEncoding = New ASCIIEncoding
Dim myParams As String = "AccessID=" & sUserID & "&Password="
&
sPassword
Dim data As Byte() = encoding.GetBytes(myParams)
Dim LOGIN_URL As String =
"https://www.blahblan.com/blah/blah.asp?WCE=RemoteLogon&IRL=T"
Dim WebRequest As HttpWebRequest =
CType(WebRequest.Create(LOGIN_URL), HttpWebRequest)
WebRequest.Method = "POST"
WebRequest.ContentLength = myParams.Length
WebRequest.ContentType = "application/x-www-form-urlencoded"
Dim myWriter As StreamWriter = New
StreamWriter(WebRequest.GetRequestStream())
myWriter.Write(myParams)
myWriter.Close()
At that point I would usually pull back the responsestream, but now I
just want to redirect to that website. I have tried appending the
paramaters to url to create a querystring, but that does not seem to
work. I don't know why as I don't have control over the external
application.


I don't quite get what you're trying to achieve. A redirect is always issued
by the server side. On the client side, all you can do is follow the redirect
or remain stuck where you are.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Jun 13 '06 #3
Thus wrote Tyler,
Simply put, I am trying to logon to a website. I have a url, a
username, and a password. Normally I would put that data in a
querystring like so:
https://www.blahblan.com/blah/blah.a...RL=T&username=
x;password=x
You should never put sensitive data in a query string. This stuff should
be put in the HTTP message body. Even if you use HTTPS, the passwords might
show up in a server log at the destination site.
That will not work for some reason. I don't have any control over the
recieving website. However when I try a screen scrape as before
(writing the parameters to a streamwriter), I can login and pull back
the html from that site.
Writing parameters to the request stream performs a regular HTTP POST, and
it's what you should do in this case.
Instead of a screen scrape I want to simply send the user to the new
website.


Here's what still confuses me (or I've probably missed so far): What kind
of application are you developing? Are you trying to control another web
site from your web site, or are you trying to pull data from a web site that
lacks a more decent interface like a Web service?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jun 14 '06 #4
I apologize. I know I am not making myself clear.

We have purchased a third party software. This third party software
requires you to logon to use the website. I am trying to integrate the
software into ours. In other words, they will already be signed into my
website. When I need to transfer to the 3rd party website, I want to be able
to do that seamlessly without the user knowing they are signing into a
"different" system. I can't do this with a querystring, and I don't want
to, but I need to be able to pass the current username and password to the
3rd party website to do an automatic signin. I can do this using
javascript, but I need to use VB.NET at this point. I hope that clarifies.

I appreciate your patience.
--
Tyler
"Joerg Jooss" wrote:
Thus wrote Tyler,
Simply put, I am trying to logon to a website. I have a url, a
username, and a password. Normally I would put that data in a
querystring like so:
https://www.blahblan.com/blah/blah.a...RL=T&username=
x;password=x


You should never put sensitive data in a query string. This stuff should
be put in the HTTP message body. Even if you use HTTPS, the passwords might
show up in a server log at the destination site.
That will not work for some reason. I don't have any control over the
recieving website. However when I try a screen scrape as before
(writing the parameters to a streamwriter), I can login and pull back
the html from that site.


Writing parameters to the request stream performs a regular HTTP POST, and
it's what you should do in this case.
Instead of a screen scrape I want to simply send the user to the new
website.


Here's what still confuses me (or I've probably missed so far): What kind
of application are you developing? Are you trying to control another web
site from your web site, or are you trying to pull data from a web site that
lacks a more decent interface like a Web service?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Jun 14 '06 #5
Thus wrote Tyler,
I apologize. I know I am not making myself clear.

We have purchased a third party software. This third party software
requires you to logon to use the website. I am trying to integrate
the software into ours. In other words, they will already be signed
into my website. When I need to transfer to the 3rd party website, I
want to be able to do that seamlessly without the user knowing they
are signing into a "different" system. I can't do this with a
querystring, and I don't want to, but I need to be able to pass the
current username and password to the 3rd party website to do an
automatic signin. I can do this using javascript, but I need to use
VB.NET at this point. I hope that clarifies.


What about doing a POST to login, get the response and redirect the user
afterwards?

Or display the third party site in an IFRAME?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jun 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
8
by: Victor | last post by:
I need to redirect to another web page, but that redirect will include the submission of form data. So, unlike ServerXMLHTTP which stays on the originating web page, I need the script to redirect...
1
by: Raichu | last post by:
Hi All, I'm new to VC++.net and I searched through the forums and couldn't find anything related to this. I'm trying to send a flat file from a VC++.net program to a PHP file residing on a...
2
by: DJ | last post by:
Hi, I've got following problem - after clicking button on my page I have to redirect user to another website using the post method. While redirecting I have to send some values to that website...
0
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
1
by: jaymehta | last post by:
hello friends, I am making one program in c#.net(window application) and i had made one form that accept one input i.e. no of tickets and i had specified 4 as input. There is one website on the...
3
by: BVS | last post by:
Presently, my website which is written in c# uses this command to move around my site: Response.Redirect("products.aspx?pro="+thechosenproduct) Is there a way to switch this to a POST method...
24
by: cplxphil | last post by:
Hi, Does anyone know if it's possible to post to a page without using a form? For example, if I want to pass a variable to another page without using a cookie, is there a way to pass it using...
21
by: mark | last post by:
Hello, I want to create a php scraper that will get some information from e.g. 5 sites simultaneously. I tried the following script:...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.