Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
C#
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.smartsheet.com/1.1/attachment/7951147966195588");
                request.Headers.Add("Authorization", "Bearer 672wbhnr4gt8rd5tvh9lw9n3o7");
                request.PreAuthenticate = true;
                request.Method = "GET";
                var response = (HttpWebResponse)request.GetResponse();
                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);
                string responseFromServer = reader.ReadToEnd();
                int i = responseFromServer.IndexOf(',')+1;
               string s = responseFromServer.Substring(i);
                int i1 = s.IndexOf(',')-6;
               string s1 = s.Substring(6,i1);
               WebClient wb = new WebClient();
               wb.Headers.Add("Authorization", "Bearer 672wbhnr4gt8rd5tvh9lw9n3o7");
               byte[] myDataBuffer = wb.DownloadData(s1);


ERROR:-
System.ArgumentException: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path) at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) at System.IO.Path.GetFullPathInternal(String path) at System.IO.Path.GetFullPath(String path) at System.Net.WebClient.GetUri(String path) at System.Net.WebClient.DownloadData(String address) at WebApplication4.WebForm1.Button7_Click1(Object sender, EventArgs e) in D:\RMS\visualstudio\Projects\WebApplication4\WebApplication4\WebForm1.aspx.cs:line 210
Posted
Updated 21-Apr-13 21:18pm
v2
Comments
CHill60 22-Apr-13 5:09am    
Use the Improve question link in green above to post details of the line of code that is throwing the exception and what the content of the path variable is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900