View Complete Post
I'm not sure this belongs in the BCL, but I can't find a better place. I'm trying to write a snippet that downloads and shows files. The brief process is the following
1. Write the temp file (by StreamWriter, etc, not really important)
2. Open the file with the associated program by shell execute or show the Open As dialog if no program is associated.
var p = new Process();
p.StartInfo = new ProcessStartInfo(fileName);
err = true;
if( err )
var psi = new ProcessStartInfo("rundll32.exe");
psi.UseShellExecute = false;
psi.Arguments = "shell32.dll,OpenAs_RunDLL \"" + fileName + "\"";
p.StartInfo = psi;
3. After associated program closes, delete the temp file (this is done by a background proc
We are using a third party wsp in our solution which directly adds the web parts into the web application store rather than the web part gallery(References to them are present
in IIS site's wpcatalog directory). We want to remove these web part files so that the users will not be able to add these web parts to pages directly. Or any other modification so that users will not be able to add these directly. Is there a way we can
do this programmatically?
I sometimes get the following error while printing crystal report to pdf:
System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382
The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?
Thank you very much.
I was trying your options by using "(operating system) cmdExec" to delete folders which were 15 days olders. But here i am getting error if i look into view history of sql agent job... below is my command that i gave in Job step.
EXEC xp_cmdshell 'forfiles /p "z:\backup" -d 15 /c "cmd /c if @isDir==True echo RD /Q /S @FILE&RD /Q /S @FILE"'
And the error is :
The process could not be created for step 1 of job .....(reason: The system cannot find the file specified). The Step failed.
but if i give this command in New Query Window, i am able to delete the folders successfully.
Please advice me if am wrong