Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,084 members, 7,818,246 topics. Date: Sunday, 05 May 2024 at 11:08 AM

Programming Challenge - Navigate Using Same Cache Header - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Programming Challenge - Navigate Using Same Cache Header (1226 Views)

Programming Challenge For Beginners Competition Two N20000 -SEASON 2- / Programming Challenge For Beginners N20000 / Facebook Programming Challenge Question (2) (3) (4)

(1) (Reply) (Go Down)

Programming Challenge - Navigate Using Same Cache Header by skydancer: 5:41pm On Aug 04, 2011
Ok, I've been trying this for 2 days now without success. I want to download data from a page in a website which uses basic authentication. After I automate a login to thehe website, opening a new page results in an expired session (meaning the cache navigation did not work out).
Here's the login details:
Username: 2010/170232
password: unn


After automating the login, the task is to download data from any other link (1 or 2) on the site.

The website is http://unnportal.com/cp/studentportal/std_framelogin.htm

I'd prefer ASP.NET or PHP for the code. Anyone?
Re: Programming Challenge - Navigate Using Same Cache Header by Fayimora(m): 6:10pm On Aug 04, 2011
[size=15pt]What about Perl or Ruby. WWW::Mechanize can do the job easily[/size]
Re: Programming Challenge - Navigate Using Same Cache Header by Nobody: 6:44pm On Aug 04, 2011
AH, web programming. I wish I could help, but I can't. I'll just sit back and wait for the experts to chime in.
Re: Programming Challenge - Navigate Using Same Cache Header by dellnet: 5:37am On Aug 05, 2011
Is this a programming challenge or you just need help? anways cookie name is ASPSESSIONIDACBDQTRR content was CIXXXAFBEGOIXXXLIDCFKXXX with this cookie the session will hold.

The login page return frames in the frames are .asp pages which reference the cookie, in this example I posted back the cookie to body_homepage.asp which returns the name, faculty etc. Tweak around to get the information you need. If you need more help post back here.


Dim unn As New System.Net.WebClient
Dim frmvalues As New NameValueCollection()
Dim container As New System.Net.CookieContainer
frmvalues.Add("institutioncode", "H4V9KLUT45AV"wink
frmvalues.Add("version", "2"wink
frmvalues.Add("password", "unn"wink
frmvalues.Add("loginname", "2010/170232"wink
unn.UploadValues("http://unnportal.com/cp/studentportal/homepage.asp", frmvalues)
Dim pageURI As New System.Uri("http://unnportal.com/cp/studentportal/body_homepage.asp")
container.SetCookies(pageURI, unn.ResponseHeaders(Net.HttpResponseHeader.SetCookie))
unn.Headers.Add(Net.HttpRequestHeader.Cookie, container.GetCookieHeader(pageURI))
       
Dim pageval As String
       
pageval = unn.DownloadString("http://unnportal.com/cp/studentportal/body_homepage.asp")
Response.Write("Reponse data:<br/>" + pageval)
Re: Programming Challenge - Navigate Using Same Cache Header by dellnet: 5:40am On Aug 05, 2011
@fayimora, doh! is homer on a rampage here?
Re: Programming Challenge - Navigate Using Same Cache Header by skydancer: 9:14pm On Aug 05, 2011
@dell_net: That was quite helpful over there, Have been wasting my time trying to do it using HttpWebRequest. This was quite straight and easy, Thanks so much! cheesy

(1) (Reply)

Vb.net Help / Attention Java Developers! Help Bring Javafx To smart devices! / Pls Help Review My Start-up

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.