c# - The remote name could not be resolved - webclient -
i facing error :
the remote name not resolved: 'russgates85-001-site1.smarterasp.net'
when request html contents read using web client gives me error. below code.
string strhtml = string.empty; webclient myclient = new webclient(); utf8encoding utf8 = new utf8encoding(); byte[] requesthtml; string pdffilename = "outputpdf_" + datetime.now.ticks + ".pdf"; string weburl = request.url.scheme + "://" + request.url.host + (request.url.port != 80 ? ":" + request.url.port : ""); requesthtml = myclient.downloaddata("http://russgates85-001-site1.smarterasp.net/adminsec/images/printinvoice.aspx?iid=2"); // or requesthtml = myclient.downloaddata(weburl + "?iid=3");
when put same url on local code/environment works fine.
most other location run code on indeed not have access remote location. i.e. in many corporate environment servers aren't allowed outside internet access. may want try ping/traceroute russgates85-001-site1.smarterasp.net
from other server , if there's no access - configure router/firewall (open port etc.) or use proxy
Comments
Post a Comment