473,666 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't login via POST?

I'm trying three different methods for logging into a webmail account. In
Post1() and Post2(), I always get back the login page. Not the page after
logging in. On TryCookies(), I'm not sure. It will run but there are some
other things that need to take place. Any suggestion on what is wrong with
the Post1() and Post2() or how to get TryCookies() going? Any other
guidance is appreciated.

Private Sub TryCookies()
Dim uri As New
Uri("http://netmail.verizon .net/en_US/agent/mo************* ***********@ver izon.net&passwo rd=somepassword &jsCapable=1&fr ames=0&LOCALE=e n_US&VARIANT=")
Dim cookieUri As New Uri("http://netmail.verizon .net")
Dim request As System.Net.Http WebRequest
Dim response As System.Net.Http WebResponse
request = CType(System.Ne t.WebRequest.Cr eate(uri),
System.Net.Http WebRequest)
request.CookieC ontainer = New System.Net.Cook ieContainer
request.CookieC ontainer.SetCoo kies(cookieUri,
"ABCD=G7789Ooqd owjkc7rrFA28r5h p0f78e")
'Me.rtxtShowWeb page.Text = response.Conten tEncoding()
End Sub

Private Sub Post2()

Dim encoding As New ASCIIEncoding
' Use the appropriate HTML field names to stuff into the post header
Dim PostData As String =
"?u************ ****@verizon.ne t&password=some password&jsCapa ble=1&frames=0& LOCALE=en_US&VA RIANT="
Dim Data() As Byte = encoding.GetByt es(PostData)
'Dim Cookies As New CookieContainer

' Initialise the request
Dim LoginReq As System.Net.Http WebRequest =
System.Net.WebR equest.Create(" http://netmail.verizon .net/en_US/agent/moblogin")
With LoginReq
.KeepAlive = False
.Method = "POST"
' Note: if the page uses a redirect if will fail (see below)
.AllowAutoRedir ect = False
.ContentType = "applicatio n/x-www-form-urlencoded"
.ContentLength = Data.Length
End With

' Add the POST data
Dim SendReq As Stream = LoginReq.GetReq uestStream
SendReq.Write(D ata, 0, Data.Length)
SendReq.Close()

' Obtain the response
Dim LoginRes As System.Net.Http WebResponse = LoginReq.GetRes ponse()
Dim sReader As StreamReader = New
StreamReader(Lo ginRes.GetRespo nseStream)
Dim HTML As String = sReader.ReadToE nd
Me.rtxtShowWebp age.Text = HTML
End Sub

Private Sub Post1()
Dim wrq As System.Net.WebR equest = _
System.Net.WebR equest.Create(" http://netmail.verizon .net/en_US/agent/moblogin")
wrq.Credentials = New System.Net.Netw orkCredential(" us**@verizon.ne t",
"somepasswo rd")
Dim wrp As System.Net.WebR esponse = wrq.GetResponse ()
Dim sr As New StreamReader(wr p.GetResponseSt ream())
'MessageBox.Sho w(sr.ReadToEnd( ))
Me.rtxtShowWebp age.Text = sr.ReadToEnd
sr.Close()
wrp.Close()

Dim myclient As System.Net.WebC lient = New System.Net.WebC lient
Dim bufData As Byte()
Dim firstLevelbufDa ta As String
bufData = myclient.Downlo adData("http://www.microsoft.c om")
' got the bufData now convert it into string format
' firstLevelbufDa ta is a string variable
firstLevelbufDa ta = Encoding.Defaul t.GetString(buf Data)
End Sub
Thanks,
Brett
Nov 21 '05 #1
0 1369

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

Similar topics

2
2314
by: Gill Bates | last post by:
I'm trying to login to a banking site (https://www.providentconnection.com) using vb.net. I've tried many variations of WebClient and HttpWebRequest; none of which I've got to work. My latest version is: Dim myWebClient As New WebClient Dim nvc As New NameValueCollection nvc.Add("Login", username) nvc.Add("Password", password)
1
2267
by: Brian | last post by:
Hello All, I need some help for my auto-post C# program. I tried to post something on my forum, but my forum need me to login first. How could I keep the session information in two http connections? In other words, I need to login at login url first, then post my message on post url. How to do? Thanks.
14
7880
by: n8 | last post by:
Hi, Hi have to do the followign and have been racking my brain with various solutions that have had no so great results. I want to use the System.Net.WebClient to submit data to a form (log a user in) and then redirect to the correct article. Here is the scenerio. If you are not logged into the site for certain articles you are
3
2138
by: bill | last post by:
I need to open a asp.net web form from a classic asp page, and pass a username and password to the asp.net page. The username and password exist as session variables in the classic asp application. I can't put the password in the classic asp page form as a hidden field and submit it, because someone can view source and see the password. This is a security problem I encounter in a mixed classic asp and asp.net environment. I don't...
8
3527
by: chris_fieldhouse | last post by:
Hi fairly new to php, but picking it up quite well. the question I have, is it possible for a php script which is used to validate values submitted in a form, to then post these values onto another script/page or even back to the calling form? i.e. the application I have in question is a login.htm page with a verify.php script The login.htm has a Form which captures login_id and password which are posted to verify.php
1
4528
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page, separate DB tables, etc). For one of these user types, the current application has an additional input field required for login… they have a username, password, and another “location code” field. Please don’t make me explain or justify this…...
0
5849
by: nfhm2k | last post by:
I've been trying to find a solution to this for quite some time now... I even took a look at existing scripts... Including this one... http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2 Everyone on that post seems to say its to do with the cookie's, yet if infact they had tried this script they would have found that even with the cookies enabled this...
4
1603
by: rpapaiof | last post by:
i have designed a login page in this form <?php if ( $_POST && $_POST && $_POST) { $a=file("file.txt"); foreach($a as $k => $v) { $b=trim($v); } #echo "<pre>"; print_r($b); echo "</pre>"; $success="0"; foreach($b as $k => $v) {
0
12768
by: barrybevel | last post by:
Hi, I'm trying to login to the www.vodafone.ie website using HttpWebRequest. It works fine with IE/Firefox and the .NET Web Control too, just not with my code. I think it's a redirect 302 problem. I'm using this code in a ASP.NET 2.0 application just in case that matters, maybe someone knows a better way to do this?
5
3194
by: mcfly1204 | last post by:
I am attempting to use WebRequest to access a page that requires a login/password to access. My last WebRequest continues to timeout. Any help or thoughts would be appreciated. namespace FormsAuthTest { class Program { static void Main(string args) { HttpWebRequest request = null;
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.