Here is my code and iam getting the error as "the network path was not found"
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace Wind1
{
public partial class Form1 : Form
{
string fileName = "";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
string path = "";
OpenFileDialog fDialog = new OpenFileDialog();
fDialog.Title = "Attach customer proposal document";
fDialog.Filter = "Doc Files|*.doc|Docx File|*.docx|PDF doc|*.pdf";
fDialog.InitialDirectory = @"C:\";
if (fDialog.ShowDialog() == DialogResult.OK)
{
fileName = System.IO.Path.GetFileName(fDialog.FileName);
path = Path.GetDirectoryName(fDialog.FileName);
textBox1.Text = path + "\\" + fileName;
}
}
private void button2_Click_1(object sender, EventArgs e)
{
try
{
WebClient client = new WebClient();
NetworkCredential nc = new NetworkCredential("arcs360", "arcs");
Uri addy = new Uri(@"\\10.255.1.147\Styles\" + fileName);
client.Credentials = nc;
byte[] arrReturn = client.UploadFile(addy,textBox1.Text);
MessageBox.Show(arrReturn.ToString());
}
catch (Exception ex1)
{
MessageBox.Show(ex1.Message);
}
}
}
}3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Afzaal Ahmad ZeeshanRank #60 · 27.6K pointsPosted Apr 4, 2015, 5:44 AM EDT
Mostly, requests to the IP address based URIs are prevented, you can always consider using your own domain name. Or contact your web server admin for more infomration on this task.
shiva prasad13 pointsPosted Apr 4, 2015, 7:24 AM EDT
Afzaal Ahmad ZeeshanRank #60 · 27.6K pointsPosted Apr 4, 2015, 7:28 AM EDT