Click here to Skip to main content
15,901,284 members
Home / Discussions / C#
   

C#

 
GeneralRe: using a List<> object in an abstract class Pin
Giorgi Dalakishvili9-Apr-08 0:10
mentorGiorgi Dalakishvili9-Apr-08 0:10 
GeneralPassing Data between 2 exes. Pin
Ian Uy7-Apr-08 6:01
Ian Uy7-Apr-08 6:01 
GeneralRe: Passing Data between 2 exes. Pin
Anthony Mushrow7-Apr-08 6:06
professionalAnthony Mushrow7-Apr-08 6:06 
GeneralRe: Passing Data between 2 exes. Pin
Christian Graus7-Apr-08 11:33
protectorChristian Graus7-Apr-08 11:33 
GeneralRe: Passing Data between 2 exes. Pin
Ian Uy7-Apr-08 19:06
Ian Uy7-Apr-08 19:06 
GeneralCyrillic Problem Pin
nike_arh7-Apr-08 5:17
nike_arh7-Apr-08 5:17 
Questionshowing form concurrently Pin
DoubleB7-Apr-08 5:15
DoubleB7-Apr-08 5:15 
GeneralProblem in uploading file with HttpWebRequest Pin
Chintan.Desai7-Apr-08 5:08
Chintan.Desai7-Apr-08 5:08 
Hi all,

I am getting problem in uploading file with ASP.NET (C#). I have set almost all property of HttpWebRequest instance. I have too set properties in my Virtual directory.

I am getting error as "Cannot connect to the configuration database". I dont know what is configuration database in these case. My application takes 10 second when it execute the below code:

HttpWebResponse httpResponse =httpWebResponse)httpRequest.GetResponse();

I have used Stream to write uploaded file content. It seems to be working fine. Even I am getting my Stream object by GetRequestStream().

========================================================================

here is my code.

string URI = "http://" + txtServerIP.Text + "/" + "VDir" + "/" + fUpload.FileName;

HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(new Uri(URI));

FileInfo fileInfo = new FileInfo(fUpload.PostedFile.FileName);

httpRequest.Method = WebRequestMethods.Http.Put;
httpRequest.AllowWriteStreamBuffering = true;
httpRequest.Credentials = new NetworkCredential(txtUserName.Text, txtPassword.Text);


httpRequest.ContentLength = fileInfo.Length;
httpRequest.ContentType ="text/html";

FileStream fs = new FileStream(fUpload.PostedFile.FileName,FileMode.Open);

Stream stream = httpRequest.GetRequestStream();
contentLength = fs.Read(buff, 0, buffLen);

while (contentLength != 0)
{
stream.Write(buff, 0, contentLength);
contentLength = fs.Read(buff, 0, buffLen);
}
stream.Close();
fs.Close();

//Here it takes 10 seconds.Mad | :mad:
HttpWebResponse response = (HttpWebResponse)httpRequest.GetResponse();

Could you pls help me.

Thanks,

Regards
Chintan
HCL Technologies...India
(Carefully) listen->(Deeply)Think->(Clearly)Understand->(Patiently) reply...

GeneralRe: Problem in uploading file with HttpWebRequest Pin
Mark J. Miller7-Apr-08 6:01
Mark J. Miller7-Apr-08 6:01 
GeneralCross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
parth.p7-Apr-08 5:06
parth.p7-Apr-08 5:06 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
lsconyer7-Apr-08 5:20
lsconyer7-Apr-08 5:20 
AnswerRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
carbon_golem7-Apr-08 5:57
carbon_golem7-Apr-08 5:57 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
half-life7-Apr-08 8:20
half-life7-Apr-08 8:20 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. [modified] Pin
parth.p7-Apr-08 8:38
parth.p7-Apr-08 8:38 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
half-life7-Apr-08 9:02
half-life7-Apr-08 9:02 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Luc Pattyn7-Apr-08 9:05
sitebuilderLuc Pattyn7-Apr-08 9:05 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
half-life7-Apr-08 9:07
half-life7-Apr-08 9:07 
Generalreturning strings from c to c# Pin
long_il7-Apr-08 4:47
long_il7-Apr-08 4:47 
GeneralRe: returning strings from c to c# Pin
led mike7-Apr-08 4:49
led mike7-Apr-08 4:49 
GeneralRe: returning strings from c to c# Pin
Luc Pattyn7-Apr-08 5:53
sitebuilderLuc Pattyn7-Apr-08 5:53 
GeneralRe: returning strings from c to c# Pin
half-life7-Apr-08 7:43
half-life7-Apr-08 7:43 
GeneralRe: returning strings from c to c# Pin
Luc Pattyn7-Apr-08 8:06
sitebuilderLuc Pattyn7-Apr-08 8:06 
GeneralRe: returning strings from c to c# Pin
half-life7-Apr-08 8:13
half-life7-Apr-08 8:13 
QuestionShould I always call the Disposal() method of a object after using it? Pin
Secret_Garden7-Apr-08 4:10
Secret_Garden7-Apr-08 4:10 
GeneralRe: Should I always call the Disposal() method of a object after using it? Pin
Pete O'Hanlon7-Apr-08 4:18
mvePete O'Hanlon7-Apr-08 4:18 

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.