|
Hey guys
currently i need a fucntion to delete file before i could create again. Currently i am using this
string dir = System.Configuration.ConfigurationSettings.AppSettings.Get("dir");
string[] imgList = Directory.GetFiles(dir, "*.*");
foreach (string img in imgList)
{
FileInfo imgInfo = new FileInfo(img);
imgInfo.Delete();
}
However when the file is stil in used this will hit an error
Please advise
Thanks a million bro
KaKaShi HaTaKe
|
|
|
|
|
The windows OS doesn't allow you to do this so the only way I've found to do this is to get a program call moveonboot which will move the file on restart.
Don't think there is a way to do it in code.
Hope this helps.
|
|
|
|
|
You can check to see if the file is locked or not using following code
public bool FileIsLocked(string strFullFileName) {
bool blnReturn = false;
System.IO.FileStream fs;
try {
fs = System.IO.File.Open(strFullFileName, IO.FileMode.OpenOrCreate, IO.FileAccess.Read, IO.FileShare.None);
fs.Close();
}
catch (System.IO.IOException ex) {
blnReturn = true;
}
return blnReturn;
}
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Guys Ive got a problem which I think should be straight forward to solve.
Basically Ive got this application which I am trying to make changes to the c# files.
However the changes are not registering. I can change the ascx files no problem.
My usual method of updating any c# files is to simply edit the page in vwd2005 and then save the file.
Any help or suggestions would be great!
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Are you trying to make the changes while the application/Website is running?
Is it an application or a website?
Sorry but a little bit confused about the problem.
|
|
|
|
|
Basically Ive got an application which is on a citrix server and is registered as a virtual directory in IIS.
However when I try and change a c# file I can make the change and save it, but it doesnt update on the server.
if I update a .ascx file it updates on the server.
Why would this be?
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
That does seem quite strange. It could maybe be a setting in your IIS. Check you have right acces to that folder.
Apart from that I'm stumped.
|
|
|
|
|
yeah ive got the right access to the files.
Thanks anyway!
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
When you say it doesn't update on the server - is your server application pre-compiled? Simply updating C# files might not be sufficient to get the change deployed?
|
|
|
|
|
Well its the YAF forum which Im using and I thought the application was pre-compiled.
How would I know?
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Dear all,
I am using ajax Calender Extender and I want to highlight more then one date in the month,
Can anyone have an idea regarding this
Thanks in advance..
devendra
|
|
|
|
|
HI
Can any one let me know what are business Benifits of migrating to ASP.NET 3.5 or .NET 3.5, so i can conviencie my client, thankx in adavance.
|
|
|
|
|
Brother, ASP.Net 3.5 means that it uses the .Net framework 3.5...
That means, ASP.Net depends on the version of .net framework...so how come the migration point comes here???
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello
Is it possible to display pictures in repeater without postback, maybe with client callback?
Please help
Shay Noy
|
|
|
|
|
Hello Friend!
I've faced a problem in getting Private key.
I installed FindPrivateKey exe.
When I enter following command line argument, it displays help contents-
C:\Tools\FindPrivateKey\CS\bin>FindPrivateKey My LocalMachine -t "7e 3b f9 fc f6 79 44 3e 5a b6 c6 a2 af e6 ca a2 b5 c9 51 9b" -a
FindPrivateKey helps user to find the location of the Private Key file of a X.509 Certificate.
Usage: FindPrivateKey [{ {-n } | {-t
humbprint>} } [-f | -d | -a]]
subject name of the certificate
thumbprint of the certificate (use certmgr.exe to get it)
-f output file name only
-d output directory only
-a output absolute file name
e.g. FindPrivateKey My CurrentUser -n "CN=John Doe"
e.g. FindPrivateKey My LocalMachine -t "03 33 98 63 d0 47 e7 48 71 33 62 64 76 5c 4c 9d 42 1d 6b 52" -c
Please, help me to find the private key.
Thanks.
With Regards,
Samrat
|
|
|
|
|
Hi i cerated one console application...,
It will send email...,
Now i want run this console automatically on every last day of the month ...,
So i will put in schedular task...,but there is no option is there for assign last day of the month...,
plz help me how to tell in schedular last day of the month...,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
You are in a wrong forum.
Create a windows service so that you can check system date to find end of the month.
|
|
|
|
|
Schedule it to run every day and check in the app to see if its the last day of the month - if not just close down.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hey...
Everything when i send mail with some huge attachment file this error occur - Web.HttpException: The transport lost its connection to the server. What the issue or any solution that i can resolve this issue?
Thanks a million
KaKaShi HaTaKe
|
|
|
|
|
Open Web.Config file of your solution and add the following in the System.web section of configuration section , like its added below
httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"
Increasing the execution timeout will solve your problem. Please note that it is in seconds.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Hi bro..... The webconfig setting is already according as what u mention but the issue still arise
it still show Web.HttpException: The transport lost its connection to the server. Cos i sending multiply attachment too...
KaKaShi HaTaKe
|
|
|
|
|
increase the executiontimeout to something like 600
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
bro i have increase till 1000 result still the same. Dos sending multiply attachment affect the issue as well?
KaKaShi HaTaKe
|
|
|
|
|
then try changing it in the machine.config file. Though i dont think it will have much of an effect. Can you post your code?
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
I upload using fileupload in the toolbox
if (FileUpload5.PostedFile.FileName.Length > 0)
{
FileUpload5.PostedFile.SaveAs(strBaseDir + Path.GetFileName(FileUpload5.PostedFile.FileName));
attach1 = strBaseDir + Path.GetFileName(FileUpload5.PostedFile.FileName);
}
if (FileUpload1.PostedFile.FileName.Length > 0)
{
FileUpload1.PostedFile.SaveAs(strBaseDir + Path.GetFileName(FileUpload1.PostedFile.FileName));
attach2 = strBaseDir + Path.GetFileName(FileUpload1.PostedFile.FileName);
}
then i send
MailMessage mail = new MailMessage();
mail.To = mailto;
mail.From = mailfrom;
mail.Cc = strUserId + System.Configuration.ConfigurationSettings.AppSettings.Get("CCList");
mail.Subject = subject;
mail.BodyFormat = MailFormat.Html;
mail.Body = body;
if (attach1 != "")
{
MailAttachment attachFile1 = new MailAttachment(attach1);
mail.Attachments.Add(attachFile1);
}
if (attach2 != "")
{
MailAttachment attachFile2 = new MailAttachment(attach2);
mail.Attachments.Add(attachFile2);
}
if (attach3 != "")
{
MailAttachment attachFile3 = new MailAttachment(attach3);
mail.Attachments.Add(attachFile3);
}
if (attach4 != "")
{
MailAttachment attachFile4 = new MailAttachment(attach4);
mail.Attachments.Add(attachFile4);
}
if (attach5 != "")
{
MailAttachment attachFile5 = new MailAttachment(attach5);
mail.Attachments.Add(attachFile5);
}
SmtpMail.SmtpServer = System.Configuration.ConfigurationSettings.AppSettings.Get("SmtpServer");
SmtpMail.Send(mail);
KaKaShi HaTaKe
|
|
|
|