using the code below i need to be able to pass different server names into the URI dynamically.
is there a way to do that? i have tried to pass it as a string and i get the error listed below. i also tried to pass it as a uri and that also errors. If i hard code @"\myserver" into theNetCache.Add(new Uri(@"\myserver"), "Basic", theNetworkCredential);
it works. I cant have it hard coded since i need to be able to dynamically create the server on the go.
Uri relativeUri = new Uri(@"\myserver", UriKind.Relative);
string url =@"\myserver";
NetworkCredential theNetworkCredential = new NetworkCredential(username, password);
CredentialCache theNetCache = new CredentialCache();
theNetCache.Add(new Uri(url), "Basic", theNetworkCredential);
System.UriFormatException HResult=0x80131537 Message=Invalid URI: The format of the URI could not be determined. Source=test PDF
StackTrace: at test_PDF.openPDF.showPDF() in C:\Code\test PDF\test PDF\openPDF.aspx.cs:line 44 at test_PDF.openPDF.btnTest_Click(Object sender, EventArgs e) in C:\Code\test PDF\test PDF\openPDF.aspx.cs:line 146