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

Why can't access this site with WebReqest?

If you type directly this address
http://www.parkoz.com/zboard/login_c...to_login=false
into your browsers (IE or Opera) and press enter, it shows a page
anyway.
But in the following code, just throws a time-out exception.
I think the server is checking the client somehow, and decided that my
application is not a normal web browser. Some sites seem to check
referer string, but in this case, I disabled referer and cookie in
Opera, but it was still displayed in Opera.
Do you have any idea?
HttpWebRequest req=(HttpWebRequest)
HttpWebRequest.Create("http://www.parkoz.com/zboard/login_check.php?user_id=xxx&password=xxxx&auto_log in=false");
req.CookieContainer=new CookieContainer();
req.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)";
req.Timeout=2000;
req.Referer="http://www.parkoz.com";
req.KeepAlive=true;
WebResponse res;
res=req.GetResponse();
StreamReader sr=new StreamReader
(res.GetResponseStream(),System.Text.Encoding.Defa ult);
string temp=sr.ReadLine();
sr.Close();
res.Close();
System.Diagnostics.Debug.Write(temp);

Feb 14 '06 #1
2 1304
Hello, Sin!

SJh> If you type directly this address
SJh> http://www.parkoz.com/zboard/login_c...&password=xxxx
SJh> &auto_login=false into your browsers (IE or Opera) and press enter, it
SJh> shows a page anyway.
SJh> But in the following code, just throws a time-out exception.
SJh> I think the server is checking the client somehow, and decided that my
SJh> application is not a normal web browser. Some sites seem to check
SJh> referer string, but in this case, I disabled referer and cookie in
SJh> Opera, but it was still displayed in Opera.
SJh> Do you have any idea?

Probably some http headers are missing ( e.g. accept ).
You can install fiddler application to browse for http headers and include missed ones in your HttpWebRequest
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 14 '06 #2
HttpWebRequest has properties Accept, ContentType, Method, Expect etc. These properties correspond to appropriate http headers

here are sample headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.6) Gecko/20040113
accept-language: en-us,en;q=0.5
accept-encoding: gzip,deflate
accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
keep-alive: 300
Host: localhost
Connection: Keep-Alive

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 14 '06 #3

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

Similar topics

4
by: TrinityPete | last post by:
Hi all, We have a web application that uses web services for data access and retrieval. The web app and web services reside under IIS on the same server(WIN2003). The virtual directories have...
9
by: CK | last post by:
Hi All, I have a sharepoint site on a box. I can hit the box by going to the ip address http://10.0.0.1/default.aspx but I can not hit it by name. The password dialong box comes up and it rejects...
0
by: raylopez99 | last post by:
10 years ago, the below was written (see very end, after my signature RL). What, if anything, has changed? I have Access 2003 and soon Access 2007 on a Windows XP Professional or Windows...
0
by: =?Utf-8?B?RG9u?= | last post by:
I've created a website at port 80, with a hostheader of "TestLab". The site is configured for Integrated Security; identity impersonate="true". I can access the website from an external server...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.