473,811 Members | 3,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking website that requires cookies

Hello, this is my first foray into the world of web programming, and none of
the searching I've done to solve this problem has left me any the wiser, so
I hope someone out there can help...
What I'm trying to do:

There is a turn based strategy game I play that has a web interface. I want
to write a tool to check my status webpage every so often to see if I have
new turns to play, and go 'beep' and briefly show a pop up if I do - just
like many email clients do with new mail.

Progress so far:

After a bit of Googling and looking at the MSDN I've written a simple method
which will return the source code of a bog standard web page (code below).

Where I got stuck:

The web interface for the game requires me to login. Once logged in,
persistent cookies keep me logged on until I specifically logout. I was
hoping that after logging on in the usual way my method would return the
HTML for my game status page, however instead all I get is the source for
the login page.

Help!:

How do I use cookies so that my application is logged in, and gives me the
source of the page I want? Is this even what I need to do? Or how do I
login fresh each time then get the source? All advice gratefully received.

' Returns HTML source of 'sUrl'.
Public Function Fetch(ByVal sUrl As String) As String

Dim s As String ' Storage for the HTML
Dim buf(8192) As Byte ' Buffer for stream reads

Dim req As HttpWebRequest = CType(WebReques t.Create(sUrl),
HttpWebRequest)
Dim resp As HttpWebResponse = CType(req.GetRe sponse(),
HttpWebResponse )
Dim respStream As Stream = resp.GetRespons eStream()

Dim tempString As String
Dim count As Integer = 0

Do
count = respStream.Read (buf, 0, buf.Length)
If count <> 0 Then
tempString = Encoding.ASCII. GetString(buf, 0, count)
s = s & tempString
End If
Loop While count > 0

Return s

End Function

Nov 21 '05 #1
0 905

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

Similar topics

0
11571
by: Antwerp | last post by:
Hi, I'm trying to create a perl script that will log into a website (the login form uses POST), navigate to several pages, and append the (html) content parsed from those pages to a seperate log file. I'm not very familiar with this aspect of perl, and have been having some trouble in the POSTing of the form data, while using cookies to log in. Visting the site automatically redirects you to a login page. Once you fill out the login...
0
333
by: Lucifer | last post by:
Hi I have some code for checking for cookies, that sets a cookie on page1 and checks for it on page2. and its based on the code by MS: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchaspnetcookies101.asp under section: 'Checking Whether a Browser Accepts Cookies' This code works great, when its in my development enviroment.
3
1510
by: marks542004 | last post by:
Hi, sorry if the title is confusing. I regularly visit a website whicg is a specialist website for custom engineering products. The website puts up a banner ad about specials available from associated businesses using my specific town name. (example: Get your referance Books from Bookworld, xxxxxxx (my town name)) Most of the time these make no sense whatever because my town is less
6
1321
by: Alan | last post by:
Hi All, I am trying to make a few calls in succession to a website to allow me to login and then perform a search, in a c# windows program. wcResponse = wc.UploadData("http://www.website.com/login?service2&user=joebloggs&blah","P OST", new byte{}); wcResponse =
13
1827
by: Peter Chant | last post by:
I'm considering setting a website up for a club. I do not plan the contents to be for public consumption, but on the other hand I'm not going to have anything on there that is confidential, that would cause a problem if it went further. The basic reason is for publicity of club events. I want to make it easy to use. I suspect a login with a password would be too much effort for most people. I also note that computer literacy is not a...
4
4053
by: Jeff | last post by:
I have a vb.net application (2005) requiring session variables and want to test to make certain that the user's cookies are enabled. I can set a test session variable on one page and attempt to read it on the next with the code below in order to determine if the user has their browser's cookies enabled, but is there a good way to do this on the first/default page without a redirect to another page that will actually do the test? Thanks
0
12801
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?
9
2982
by: xhe | last post by:
Hi, I need to program to check the validity of IP address through PHP Initially I used this one: $url="http://www.ntc.gov.au/ViewPage.aspx? page=A02400304500100020"; $fp=fopen($url,"r"); if(!$fp) {
0
1201
by: Rama Jayapal | last post by:
i use the following code to login to a website but i dont achieve my purpose can anybody help me on this //code to request the page webRequest = HttpWebRequest.Create(url) as HttpWebRequest;
0
9605
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
10136
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...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
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...
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
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.