Click here to Skip to main content
16,006,006 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRegister a DLL (SolPartWebMenu) Pin
RX Maverick28-Dec-06 5:50
RX Maverick28-Dec-06 5:50 
QuestionRequiredFieldValidator Pin
krutika_mail28-Dec-06 4:03
krutika_mail28-Dec-06 4:03 
AnswerRe: RequiredFieldValidator Pin
Not Active28-Dec-06 5:13
mentorNot Active28-Dec-06 5:13 
AnswerRe: RequiredFieldValidator Pin
ednrgc28-Dec-06 8:42
ednrgc28-Dec-06 8:42 
Questionasp:Table vs. an HTML table Pin
RX Maverick28-Dec-06 3:29
RX Maverick28-Dec-06 3:29 
AnswerRe: asp:Table vs. an HTML table Pin
Not Active28-Dec-06 4:05
mentorNot Active28-Dec-06 4:05 
GeneralRe: asp:Table vs. an HTML table Pin
RX Maverick28-Dec-06 5:27
RX Maverick28-Dec-06 5:27 
QuestionHow to create a file watcher window service to look in a folder for new file?? Pin
garimajain_mca28-Dec-06 2:31
garimajain_mca28-Dec-06 2:31 
Goal of the filewatcher window service: to look in a folder named ‘Watcher’ for a particular type of file. Whenever a new file arrives in the watcher folder, service should pick up the file, read contents, then delete the file from the folder and move it in another folder named ‘Processed’.
I am using filewatcher’s oncreated event for this. Whenever a file arrives, the oncreated event is fired. The problem I am facing is that the service is not able to read the file. The exception received is: The process cannot access the file
'\\WATCHER\abc_1959537.xml' because it is being used by another process. I tried to manually paste the files in ‘Watcher’ folder as well as in automated manner by a console application the result is same. Please help!
I m using this code:

private void filewatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{
log.Info("file found :" + e.FullPath);
try
{
//Get the path of the recently arrived file
string fpath = e.FullPath;

//Get the xml string from file
FileStream objStream= new FileStream(filename, FileMode.Open,FileAccess.Read,FileShare.Read);
StreamReader sr = new StreamReader(objStream);
string tempstring = "";
string filestring = "";
while ((tempstring = sr.ReadLine()) != null)
{
filestring += tempstring;

}
sr.Close();
sr.Dispose();

//Move file in a new folder

FileInfo fi = new FileInfo(e.FullPath);
fi.Directory.CreateSubdirectory("updated");
File.Copy(e.FullPath, fi.DirectoryName + "\\Updated\\" + fi.Name, true);
fi.Delete();

log.Info("File Sucessfuly moved: " + fpath);
}
catch (Exception ex)
{
log.Info(ex.Message);
}

}

AnswerRe: How to create a file watcher window service to look in a folder for new file?? Pin
GaryWoodfine 28-Dec-06 11:58
professionalGaryWoodfine 28-Dec-06 11:58 
GeneralRe: How to create a file watcher window service to look in a folder for new file?? Pin
garimajain_mca28-Dec-06 21:18
garimajain_mca28-Dec-06 21:18 
GeneralRe: How to create a file watcher window service to look in a folder for new file?? Pin
GaryWoodfine 29-Dec-06 10:15
professionalGaryWoodfine 29-Dec-06 10:15 
QuestionBorder Color Pin
248912828-Dec-06 2:14
248912828-Dec-06 2:14 
AnswerRe: Border Color Pin
Venkatesh Mookkan28-Dec-06 17:46
Venkatesh Mookkan28-Dec-06 17:46 
GeneralRe: Border Color Pin
248912828-Dec-06 19:39
248912828-Dec-06 19:39 
GeneralRe: Border Color Pin
_AK_28-Dec-06 20:31
_AK_28-Dec-06 20:31 
JokeRe: Border Color Pin
Venkatesh Mookkan28-Dec-06 21:15
Venkatesh Mookkan28-Dec-06 21:15 
QuestionASP.NET Pin
analyst200128-Dec-06 1:28
analyst200128-Dec-06 1:28 
GeneralRe: ASP.NET Pin
Eduard Keilholz28-Dec-06 1:41
Eduard Keilholz28-Dec-06 1:41 
QuestionWeb service, adding a web reference to a web service over the internet Pin
steve_rm28-Dec-06 1:14
steve_rm28-Dec-06 1:14 
QuestionEncrypting files on server side Pin
Rankor2028-Dec-06 0:47
Rankor2028-Dec-06 0:47 
AnswerRe: Encrypting files on server side Pin
Eduard Keilholz28-Dec-06 1:33
Eduard Keilholz28-Dec-06 1:33 
GeneralRe: Encrypting files on server side Pin
Rankor2028-Dec-06 2:12
Rankor2028-Dec-06 2:12 
GeneralRe: Encrypting files on server side Pin
Eduard Keilholz28-Dec-06 2:19
Eduard Keilholz28-Dec-06 2:19 
Questionproblem with timer Pin
MissionSuccess28-Dec-06 0:22
MissionSuccess28-Dec-06 0:22 
AnswerRe: problem with timer Pin
Eduard Keilholz28-Dec-06 1:35
Eduard Keilholz28-Dec-06 1:35 

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.