Загрузка файла на страницу aspx из C #. Получение:
PathTooLongException
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Вот код:
try
{
using (var client = new WebClient())
{
String url =
String.Format(
"http//localhost:49536/ManualUploadTest.aspx?key={0}&name={1}&address={2}&phone={3}&email={4}&node={5}",
"changeme",
"john",
"10 Downing Street",
"555 555 6165",
"test@yahoo.com",
"TestNode");
var len = url.Length; // this length is 146
var encodeLen = HttpUtility.UrlEncode(url).Length; // this length is 180
//client.BaseAddress = "http//localhost:49536";
byte[] result = client.UploadFile(HttpUtility.UrlEncode(url), path);
// throws exception during UploadFile
// ... more code here
Строка URL выглядит следующим образом:
http//localhost:49536/ManualUploadTest.aspx?key=changeme&name=john&address=10 Downing Street&phone=555 555 6165&email=test@yahoo.com&node=TestNode
Путь:
Y:\\10mb.zip
Спасибо за любую помощь!