james
New member
- Joined
- Nov 28, 2021
- Messages
- 2
- Programming Experience
- 3-5
HI. sir .. Can anyone help me to resolve it ? (C# , HttpWebRequest)
Why can't I crawl the data of this page ?
System.Net.WebException: The remote server returned an error: (403) Forbidden
-------------------------------------
Why can't I crawl the data of this page ?
System.Net.WebException: The remote server returned an error: (403) Forbidden
-------------------------------------
C#:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Referer = "https://read01.com/3Lmex5.html";
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36";
cookieStr = "_ga=GA1.2.157330444.1617373251; app_session=thki1lkcba6o4st5fht40q3hm0; __atssc=google;16; AMP_TOKEN=$NOT_FOUND; _gid=GA1.2.706258968.1638088493; __atuvc=0|44,2|45,19|46,3|47,4|48; __atuvs=61a33f2dc5319cf1003";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
request.Headers.Add("Cookie", cookieStr);
request.Method = "get";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Last edited by a moderator: