473,387 Members | 1,530 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,387 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 1308
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.