Hello ....... I m developing a C # application in ASP. Net of sending SMS using way2sms when I open ing http://www.way2sms.com/URL in code through HTTP protocol I m getting error at line Httpwebresponse response = (httpwebresponse) request. getresponse (); Error: the remote server returned an error: (403) forbidden. My application code is:
Httpwebrequest request = (httpwebrequest) webrequest. Create ("http://wwwk.way2sms.com/auth.cl "); Request. keepalive = false; Request. Timeout = 20000; Request. Credentials = new networkcredential ("172.23.51.111", "8082 "); // Request. connectiongroupname = "172.23.51.111 "; Byte [] bytearray = encoding. utf8.getbytes (content ); Cookiecontainer cookies = new cookiecontainer (); Request. cookiecontainer = cookies; Request. useragent = "Mozilla/5.0 "; // Request. useragent = "Mozilla/5.0 (windows; U; Windows NT 6.0; en-US; RV: 1.9.0.5) Gecko/2008120122 Firefox/3.0.5 "; Request. contentlength = bytearray. length; Request. contenttype = "application/X-WWW-form-urlencoded "; Request. Accept = "*/*"; Request. Referer = "http://wwwk.way2sms.com//entry.jsp "; Request. method = "Post "; Stream datastream = request. getrequeststream (); Datastream. Write (bytearray, 0, bytearray. Length ); Datastream. Close (); Httpwebresponse response = (httpwebresponse) request. getresponse (); Thank you.
|