我用FileUpload.SaveAs方法保存文件时,出现了这样的错误,我要实现的功能是,上传文件到另一个服务器或者域名下,而不是上传到本程序的文件夹下,如(http://域名:端口号/文件夹/),不知道该如何实现
解决方案 »
- ASP.NET我想要在用户退出或直接关闭浏览器时删除数据库中的一些表
- 开发网站突发问题
- ASP.NET调用WebService出现No WS-Security Header错误
- ASP.net怎么打开数据库中以二进制存贮的WORD文档或别的文档?
- IE中浏览网页有错误,报出的错误行找不到错误。准确位置是在什么地方。
- 咨询高手!!!!推荐一下学winform方面的书,网站,电子书之类.........
- Datagrid问题
- gridview问题
- 如何把数据库中的数据提出放到datatable中 ????
- reflector可以看到源代码吗?
- 购物车表里的信息 怎么提交到 定单表里
- 想问下上传文件的放置问题
一种是在本地启动一个服务,上传的文件先存放本地服务器,通过Windows服务转移到另外一台服务器上,转移成功之后再从本地删除;
另一种办法通过TCPClientstatic void Connect(String server, String message)
{
try
{
// Create a TcpClient.
// Note, for this client to work you need to have a TcpServer
// connected to the same address as specified by the server, port
// combination.
Int32 port = 13000;
TcpClient client = new TcpClient(server, port);
// Translate the passed message into ASCII and store it as a Byte array.
Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); // Get a client stream for reading and writing.
// Stream stream = client.GetStream();
NetworkStream stream = client.GetStream(); // Send the message to the connected TcpServer.
stream.Write(data, 0, data.Length); Console.WriteLine("Sent: {0}", message); // Receive the TcpServer.response.
// Buffer to store the response bytes.
data = new Byte[256]; // String to store the response ASCII representation.
String responseData = String.Empty; // Read the first batch of the TcpServer response bytes.
Int32 bytes = stream.Read(data, 0, data.Length);
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
Console.WriteLine("Received: {0}", responseData); // Close everything.
stream.Close();
client.Close();
}
catch (ArgumentNullException e)
{
Console.WriteLine("ArgumentNullException: {0}", e);
}
catch (SocketException e)
{
Console.WriteLine("SocketException: {0}", e);
}
Console.WriteLine("\n Press Enter to continue...");
Console.Read();
}