Hi, I am new to C# .Net and have a question. I am tryng to recursively search directories. I have found a bunch of examples. Most are done using a console application. I want to accomplish this task via the web (Web Application). Does anyone have example on how to loop recursively through directories on your hard drive and return the info to an aspx page? I will be looking for zip files and will want to put the file info into an array so I can loop through & return the information.
Thank you for your response. I forgot to specify we have not upgraded to the 2.0 framework.
System.IO.SearchOption opt = System.IO.SearchOption.AllDirectories; does not work.
My first attempt(b4 the post) was
DirectoryInfo di = new DirectoryInfo(@"C:\Temp");
foreach(DirectoryInfo file in di.GetDirectories())
Response.Write("Looking at file \""+file.FullName+"\""+" ");
But it this does not go into subdirectiories. Help.
Also, would you bind the result set to a data grid? What are the best option for displaying the result set to the web?
I want to write a self updating application. What can be the best approach? Whether i should go for Click once application deployment, or write my own code ( using BITS etc) or any other method. Please guide me in this regard.
Could you spare some time to help me with a small problem?
I need to perform encryption and decryption using the DES algorithm.
This is the way I want the program to work :
My form has 4 textboxes -
1) tbPlaintext --- For the user to enter the plaintext
2) tbCiphertext --- For displaying he ciphertext
3) tbKey --- For displaying the key
4) tbIV --- For displaying the Initialization Vector
and 2 buttons -
1) Button1 --- When clicked performs encryption using key form tbKey and the IV from the string - "init vec"
2) Button2 --- When clicked performs decryption using the key in tbKey and the IV "init vec"
The user enters the plaintext -"Hello world" and the key - "qwertyui" and clicks the Button1. The ciphertext appears in the textbox tbCiphertext ("SGVsbG8gd29ybGQ=").
This part works fine.
Now when the user clicks the Button2 , after clearing the text in tbPlaintext, the plaintext "Hello world" should appear in tbPlaintext. But what I get is "U0dWc2JHOGdkMjl5YkdRPQ==". How do you explain that?
What should I do to get my original plaintext?
The MSDN article "How To: Create an Encryption Library in .NET 1.1" at the following URL helped me with the code-
Is there something I'm missing?
Please help me as soon as possible so I can proceed with my project.
- Sreerag Gopinath P C
EMAIL : email@example.com
PHONE : +919447489699
The relevant source code is as follows -
/* ENCRYPT USING DES ALGORITHM */
private void button1_Click(object sender, System.EventArgs e)
if (tbKey.Text == "")
MessageBox.Show("Enter some key");
if (tbKey.Text.Length == 8)
DES des = new DESCryptoServiceProvider();
des.Mode = CipherMode.CBC;
I'm trying to send a large file accross a network.
the problem is that I'm losing many chunks.
At the beginning I tried to split the file myself and send it, but I had a lot of lost data, so I read about BufferedStream class that can take care of the chuncks by itself.
so, for sending the file I wrote:
stream = client.GetStream(); // to get the stream<br />
BufferedStream buff = new BufferedStream(stream);<br />
buff.Write(fileBytes, 0, fileBytes.Length); // writing the file<br />
for getting the file I wrote:
socket = listener.AcceptSocket();<br />
NetworkStream stream = new NetworkStream(socket);<br />
byte filebyte = new byte[filesize]; // creating array at the size of the file<br />
BufferedStream buff = new BufferedStream(stream);<br />
int readByte = 1;<br />
while(readByte > 0) // when readByte is -1 it is the end of the stream<br />
readByte = buff.Read(filebyte, 0, filebyte.Length);<br />
File.WriteAllBytes(filename, filebyte);<br />
The problem is that I still lose data, I really don't know what else to do.
im working on an application p2p filesharing and messaging.
im trying to do it over HTTP:80. packets can be dropped routers and firewalls, so i want to use port 80.
is it possible to communicate between clients 2 clients and clients to server over HTTP without installing IIS (except servers)?
I am working on an app (windows) in which I need to provide a functionality to create object connectors (using mouse events). Kinda like when you try to make a DTS package in SQL Server you connect two ojbect and it draws a nice graphics to represent the connected objects. Or Table Designer when you try to relate two fields in seperate tables.
Does anyone know if there is a way to access command line arguments from one running application in another application. I want to have a windows service that looks for other running apps and runs them when necessary. Sometimes there may be more than one instance running with different arguments, so I need a way to see what arguments the running instance is using. I tried looking at processes that I get when calling GetProcessesByName and then looking at StartInfo Arguements, but it appears to be empty even when I have passed in parameters. I know my parameters have been accepted because I an display them in a message box. Any help on this would be greatly appreciated.
Please I need some help. I am totally lost on this and have used all my thinking power to deal with this issue and no luck. I have an application that uses System.Web.Mail to transmit emails, in every 5-6 emails that go out one stalls giving the above error with inner exception as follows:
The transport failed to connect to the server and sometimes it says The transport lost it's connection to the server.
We have a mail marshal server that also acts as a dummy smtp server to filter the emails and that is where I am directing these emails to. This dummy server acts as a filter to the emails and diverts them to the main email server with a port not 25 hence I can't divert them through that main server. Do you think this could be a problem?
Dummy server is the SMTP server I am using and has a port 25. Our SMTP server configurations are through Exchange.
Hi guys, i need to execute such a file and supply it arguments, i've looked around and found the "System.Diagnostics.Process.Start()" method, it works great, but i want controll over the executed application... or at least run it in a minimized window state...
(The executable is a program written in c)