|
Hi Giorgi,
thanks for everything, to all the people that replied
living life on the flip side
|
|
|
|
|
hi,
in my application i need to upload the data to the serevr using ftpwebrequest method .I need to upload 2 files one is a zip file (more than 10 MB) and other is a text file to the same server. when iam uploading total zip content is not getting uploaded to the serevr and its returning error like
" The underlying connection was closed: An unexpected error occurred on a receive." So please can anybody help me where exactly the problem is.Is that the problem with the code or serevr settings.
Thanks in advance
Here is my code
private static void Upload()
{
string[] strar = new string[] { sourcepath + ".zip", sourcepath + ".txt" };
foreach (string str in strar)
{
FileInfo fileInf = new FileInfo(str);
string uri = "ftp://" + ftpServerIP + "/" + fileInf.Name;
FtpWebRequest reqFTP;
// Create FtpWebRequest object from the Uri provided
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileInf.Name));
//Set the proxy to null to get around the "the requested ftp command is not supported when using http proxy" error
reqFTP.Proxy = null;
reqFTP.Timeout = 2000000000;
// Provide the WebPermission Credintials
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
// By default KeepAlive is true, where the control connection is not closed
// after a command is executed.
reqFTP.KeepAlive = false;
// Specify the command to be executed.
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
// Specify the data transfer type.
reqFTP.UseBinary = true;
// Notify the server about the size of the uploaded file
reqFTP.ContentLength = fileInf.Length;
// The buffer size is set to 2kb
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
// Opens a file stream (System.IO.FileStream) to read the file to be uploaded
FileStream fs = fileInf.OpenRead();
try
{
// Stream to which the file to be upload is written
Stream strm = reqFTP.GetRequestStream();
//mydelegate delinstance = new mydelegate(Writedata);
//int result;
//Stream strm = reqFTP.BeginGetRequestStream(null, null);
//Stream strm = reqFTP.BeginGetRequestStream(delinstance,result);
// Read from the file stream 2kb at a time
contentLen = fs.Read(buff, 0, buffLength);
//progressBar1.Maximum = contentLen;
// Till Stream content ends
//progressBar1.Step=10;
while (contentLen != 0)
{
// Write Content from the file stream to the FTP Upload Stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
//if (progressBar1.Value < progressBar1.Maximum)
// progressBar1.PerformStep();
}
//progressBar1.Value = 0;
// Close the file stream and the Request Stream
strm.Close();
fs.Close();
Console.WriteLine("Uploading completed for file " + str);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message, " Upload Error");
Console.ReadLine();
}
Console.ReadLine();
}
}
|
|
|
|
|
I HAVE ONE TEXTBOX TO GET MOBILE NUMBER AS INPUT....
IF ANY TEXT ENTER IN THE TEXTBOX MEANS IT WILL SHOW...
"ENTER ONLY DIGITS"....
SEND ME SUGESSTION...
USING WINDOWS APPLICATION...
|
|
|
|
|
1. Don't use caps lock while posting a question.
2. Don't request something, just as nicely
3. Look at KeyPressed event of textbox or use Google to find more help.
|
|
|
|
|
Use masked textbox.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I am creating a folder watcher application.
If a new powerpoint file gets added in the folder it should get started automatically.
So if I put .pps file into the folder then and I say
System.Diagnostics.Process.Start(fullPath);
it works fine.
This is not the case with .ppt files
Only the powerpoint application gets started not the slideshow.I want the slideshow to be started.
I have done some R & D and found that Microsoft.Office.Interop.PowerPoint will help and done something like this
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();<br />
ppApp.Visible = MsoTriState.msoTrue;<br />
Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;<br />
Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(e.FullPath,<br />
MsoTriState.msoFalse, MsoTriState.msoFalse,<br />
MsoTriState.msoTrue);<br />
But this is also doing the application open not the slideshow, does anybody have any idea?
Also I want rest all powerpoint presentations gets closed and only currently added powerpoint application gets started as slideshow.
Thanks in advance,
|
|
|
|
|
I'm not sure how possible that is. If double clicking doesn't open PPT, then PPT is not responding to being passed the application as a command parameter.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for quick reply,
I am not very much clear with your answer.
Actually I want the ppt application start automatically when it gets placed in the folder under watch.
|
|
|
|
|
salon wrote: I want the ppt application start automatically when it gets placed in the folder under watch.
Assuming you have a FolderWatch watching on the folder, when a file is placed in the folder, run Process.Start("YourPPTFileName") . It will open the PPT file in associated application.
|
|
|
|
|
yes. You are correct. This code segment will start the ppt application, but i want to start the slideshow.... not the applciation...
If u use the same code segment for .pps files, it will start the slideshow directly....
The same thing I want with .ppt files.....
I know there is a way with
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
And inside this there is an event named "SlideShowBegin" but I am not getting how to use this event to start the slideshow....
|
|
|
|
|
|
Thanks friends for your valuable replies. The main problem is solved of launching the slideshow of .ppt files.. with the help of this code
<br />
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();<br />
ppApp.Visible = MsoTriState.msoTrue;<br />
Presentations ppPresens = ppApp.Presentations;<br />
Presentation objPres = ppPresens.Open(e.FullPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);<br />
Slides objSlides = objPres.Slides;<br />
Microsoft.Office.Interop.PowerPoint.SlideShowWindows objSSWs;<br />
Microsoft.Office.Interop.PowerPoint.SlideShowSettings objSSS;<br />
<br />
objSSS = objPres.SlideShowSettings;<br />
<br />
objSSS.Run();<br />
objSSWs = ppApp.SlideShowWindows;<br />
while (objSSWs.Count >= 1) System.Threading.Thread.Sleep(100);<br />
<br />
objPres.Close();<br />
ppApp.Quit();<br />
Now I want to close all the running powerpoint files and only want to run the current one only...
Does any body have any idea?
|
|
|
|
|
First off having urgent in your subject line is really irritating and almost made me not answer however...
Why not close or kill off powerpoint and then restart it when you detect the file using filewatcher. That way you will only have your powerpoint open and it will display.
|
|
|
|
|
Thanks for ur compliment...
Actually I had implemented the things that u have suggested now...
but my requirement is a bit different.
I want to close the powerpoint presentations in the specifiec folder only and not all the powerpoint presentations.....
That's the reason i need some technical help for acheivning this...
Thanks,
|
|
|
|
|
Like I told you before, it's probably not possible.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have some Doc files that I need to read content of each of them and write them into a for example textBox or richTextBox.
How can I do it ?
Thanks in advace
Hello Friends
|
|
|
|
|
Google broken where you live ? You need Word installed and you need to control Word through C#, there's a Microsoft Office Toolkot or something for doing that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
salam
i think u have to use a openfiledialog, select the file and do like this
myrichtextbox.Loadfile(myopenfiledialog.selectedfile,RichTextBoxStreamType.RichText)
i think this ll solve ur problem
|
|
|
|
|
This is totally, utterly incorrect. An rtf and a doc are two different things.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
It didn`t solve my problem
RTF and DOC are tow different type
Hello Friends
|
|
|
|
|
Hi,
Could anyone help me to get the best of C# opensource SMTP form below list.
1. C# Email Server (CSES)
2. DotNetOpenMail
3. NMail
Thanks in Advance
modified on Thursday, December 11, 2008 2:07 AM
|
|
|
|
|
I'm trying to create a website with youtube APIs using C# 2008 (.NET), Being a beginner and getting my feet wet with this, I wonder if anyone can give me some tips n tricks, or possibly an example code/ step by step instructions on doing this.
I've read the 'Developers Guide: .NET' on the code.google.com site and it's like trying to learn french through the internet if you know what I mean. I have made sites before but exclusively with html and css.
Main Questions:
1.What exactly do I write the C# language in? (Im using C# 2008 however how exactly do I put this on my webpage???)
2.I would loove to see a FULL snippet(s) on an actual page with youtube APIs (or any APIs for that matter, since I have not found anything with FULL code start to finish) that I can copy and paste into whatever it is I put the C# language in and try to view it on my webpage and modify it from there.
3. The Developers guide gives this:
The following code retrieves a YouTubeEntry corresponding to a video on YouTube
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/ADos_xW4_J0";
YouTubeEntry videoEntry = (YouTubeEntry) service.Get(videoEntryUrl);
Console.WriteLine("Title: " + videoEntry.Title.Text);
Console.WriteLine(videoEntry.Media.Description.Value);
I would like to know WHERE DO I PUT THIS CODE??
I am a person that learns very well visually, so pictures/code snippets/ illustrations are better than words, unless they're instructions of course. I guess you can understand the urgency of knowing this for me, thanks alot for all help
I'm sure one developer can help another developer
Thanks
-Alex-
|
|
|
|
|
bmx4637 wrote: .What exactly do I write the C# language in?
You should download the Web Developer Express Edition, it helps you create ASP.NET sites.
bmx4637 wrote: I would loove to see a FULL snippet(s) on an actual page with youtube APIs (or any APIs for that matter, since I have not found anything with FULL code start to finish) that I can copy and paste into whatever it is I put the C# language in and try to view it on my webpage and modify it from there.
bmx4637 wrote: I would loove to see a FULL snippet(s) on an actual page with youtube APIs
A youtube video is just going to be embedded HTML, they would just have a control you use, I assume.
bmx4637 wrote: I would like to know WHERE DO I PUT THIS CODE??
Well, I am not sure you know anything about ASP.NET at this point. Console.WriteLine won't help you, unless this program just emits HTML that you then embed in your aspx of your page.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If you would like to learn asp.net and c#, then I would advice this book:
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional
Welcome to the world of C#
Prateek
|
|
|
|
|
thanks
|
|
|
|