C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Help: Delete File


Posted Date: 04 Nov 2009      Posted By: Mikkel Bachmann      Member Level: Bronze     Points: 1   Responses: 2



Hi.

I have a problem deleting a file.

Error:

Der opstod en Microsoft JScript-kørselsfejl: Automation-serveren kan ikke oprette objektet

Sorce code:

public string TrashContainer(string trashFolder)
{
DirectoryInfo objDir = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + trashFolder);
FileInfo[] arrFiles = objDir.GetFiles();

string label = ("<script language=#JavaScript#><!-- function remove(filename) {var myObject;myObject = new ActiveXObject(#Scripting.FileSystemObject#);myAc.GetFile(#../../trash/# + filename, true);myAc.Delete();} // --></script>").Replace('#', '"');
label += "<table><tr><th>orginal fil</th><th>sletted den</th><th>funktioner</th></tr>";
foreach (FileInfo file in arrFiles)
{

label += "<tr>";
label += "<td>";
label += OrginalFileName(file.Name);
label += "</td>";
label += "<td>";
label += DeleteDate(file.Name);
label += "</td>";
label += "<td>";
label += ("<input type=#button# value=#slet# id=#slet# onclick=#remove('" + file.Name + "')# />").Replace('#','"');
label += "</td>";
label += "</tr>";
}
label += "</table>";
return label;
}

C# is my languages, OOP is my religion, byt i am my good!
CV - Mikkel Bachmann





Responses

Author: ABitSmart    04 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

The code you have shared has no delete functionality at all ??

Please post your question and details in English.

Kind regards,
ABitSmart
DNS Web-master, DNS MVM
My blog
Thoughts.exe



Author: Mikkel Bachmann    06 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

the delete functionality in the code is this:
<script language="JavaScript">
function remove(filename) {
var myObject;
myObject = new ActiveXObjec("Scripting.FileSystemObject");
myAc.GetFile("../../trash/" + filename, true);
myAc.Delete();
}
</script>

<input type="button" value="slet" id="slet" onclick="remove('file')" />

the # sign is insted of "

the error massage: is in Danish.
English: There was a Microsoft JScript runtime error: Automation server can not create object (acording to Google)

C# is my languages, OOP is my religion, byt i am my good!
CV - Mikkel Bachmann



Post Reply
You must Sign In to post a response.
Next : String Format for Currency
Previous : Visual studio 2008 on windows 7...
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use