Click here to Skip to main content
15,911,306 members
Home / Discussions / C#
   

C#

 
QuestionRefreshing datagrid Pin
Muammar©7-Feb-09 3:20
Muammar©7-Feb-09 3:20 
AnswerRe: Refreshing datagrid Pin
Muammar©7-Feb-09 3:58
Muammar©7-Feb-09 3:58 
GeneralRe: Refreshing datagrid Pin
Rafone7-Feb-09 5:00
Rafone7-Feb-09 5:00 
GeneralRe: Refreshing datagrid Pin
Muammar©7-Feb-09 18:56
Muammar©7-Feb-09 18:56 
Questionbest choice ? Pin
Xmen Real 7-Feb-09 2:50
professional Xmen Real 7-Feb-09 2:50 
AnswerRe: best choice ? [modified] Pin
DaveyM697-Feb-09 3:25
professionalDaveyM697-Feb-09 3:25 
AnswerRe: best choice ? Pin
Luc Pattyn7-Feb-09 3:48
sitebuilderLuc Pattyn7-Feb-09 3:48 
Questionfile upload error Pin
George_George7-Feb-09 2:43
George_George7-Feb-09 2:43 
(sorry I ask again, not resolved for a week before.)

Hello everyone,

Here is my code at both client side and server side. My code is simple, just upload a file to an ASP.Net web site.

My client code throws exception when it works on Vista (x64, Enterprise, SP1), but works fine on Windows Server 2003.

Any ideas?

10.10.12.162 is my server address.

Client:

       static void Main(string[] args)
        {
            Console.Write("\nPlease enter the URI to post data to : ");
            String uriString = Console.ReadLine();

            WebClient myWebClient = new WebClient();

            Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
            string fileName = Console.ReadLine();
            Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);

            DateTime begin = DateTime.Now;

            byte[] responseArray = null;
            try
            {
                responseArray = myWebClient.UploadFile(uriString, fileName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.ToString());
            }

            DateTime end = DateTime.Now;

            Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
        }

Server:

    public partial class FileUploadHandler : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            foreach (string f in Request.Files.AllKeys)
            {
                HttpPostedFile file = Request.Files[f];
                file.SaveAs("D:\\UploadFile\\UploadedFiles\\" + file.FileName);
            }
        }
    }

Exception from client side:

Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
   at FileUploadClient.Program.Main(String[] args) in D:\UploadFile\FileUploadClient\Program.cs:line 30


regards,
George
AnswerRe: file upload error Pin
Nicholas Butler7-Feb-09 3:34
sitebuilderNicholas Butler7-Feb-09 3:34 
GeneralRe: file upload error Pin
George_George7-Feb-09 22:19
George_George7-Feb-09 22:19 
GeneralRe: file upload error Pin
Nicholas Butler7-Feb-09 23:36
sitebuilderNicholas Butler7-Feb-09 23:36 
GeneralRe: file upload error Pin
George_George8-Feb-09 0:18
George_George8-Feb-09 0:18 
GeneralRe: file upload error Pin
Nicholas Butler8-Feb-09 2:21
sitebuilderNicholas Butler8-Feb-09 2:21 
AnswerRe: file upload error Pin
Hamid_RT15-Feb-09 21:44
Hamid_RT15-Feb-09 21:44 
Questionweb service and desktop client connectivity issue Pin
sailesh_gupta7-Feb-09 1:57
sailesh_gupta7-Feb-09 1:57 
QuestionHow to convert tiff file to text file using tesseract.ocr in C#(Asp.net)" Pin
ChandrakanthGaddam7-Feb-09 1:32
ChandrakanthGaddam7-Feb-09 1:32 
QuestionCombobox selected item issue Pin
laziale7-Feb-09 0:40
laziale7-Feb-09 0:40 
AnswerRe: Combobox selected item issue Pin
sailesh_gupta7-Feb-09 2:03
sailesh_gupta7-Feb-09 2:03 
AnswerRe: Combobox selected item issue Pin
Xmen Real 7-Feb-09 2:29
professional Xmen Real 7-Feb-09 2:29 
AnswerRe: Combobox selected item issue Pin
Dragonfly_Lee7-Feb-09 3:22
Dragonfly_Lee7-Feb-09 3:22 
QuestionBlocking internet to client systems using C# and winforms Pin
varaprasad.shetty7-Feb-09 0:34
varaprasad.shetty7-Feb-09 0:34 
AnswerRe: Blocking internet to client systems using C# and winforms Pin
NaserJaved23-Dec-09 1:31
NaserJaved23-Dec-09 1:31 
QuestionImports Problem in Crystal Report Pin
jigneshDPatel6-Feb-09 23:28
jigneshDPatel6-Feb-09 23:28 
Questioncombobox in dotnet with c# coding for windows application Pin
aratireddy6-Feb-09 22:05
aratireddy6-Feb-09 22:05 
AnswerRe: combobox in dotnet with c# coding for windows application Pin
DaveyM696-Feb-09 22:30
professionalDaveyM696-Feb-09 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.