473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

is it possible to create directory / file with asp.net?

Hi,

Is it possible to create directories and files with asp.net?
Thanks
André
Jan 6 '07 #1
9 1759
Yes.

Get sample code to do both at:
http://www.informit.com/guides/conte...eqNum=152&rl=1

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"André" <sv*@sdv.sdwrote in message news:OJ**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is it possible to create directories and files with asp.net?
Thanks
André

Jan 6 '07 #2
You just have to make sure that the ASP.Net user account has the right
privaleges in the directory that you need to create the files/folders, such
as read/write/delete.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"André" <sv*@sdv.sdwrote in message
news:OJ**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is it possible to create directories and files with asp.net?
Thanks
André

Jan 6 '07 #3
Hi,

André wrote:
Hi,

Is it possible to create directories and files with asp.net?
Thanks
André
Additionally to Juan's answer, be aware that modifying the directory
structure under the web application root will restart the application in
ASP.NET 2.0. That will clear all the open Sessions. So use it with care.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 6 '07 #4
"André" <sv*@sdv.sdwrote in message
news:OJ**************@TK2MSFTNGP03.phx.gbl...
Is it possible to create directories and files with asp.net?
Yes, with some caveats...

ASP.NET can use the System.IO namespace like any other .NET technology.
However, this will allow it to create files and or folders server-side, so
long as it has sufficient permissions to do so. Depending on how you have
your web app and/or IIS configured, the default account that ASP.NET runs
under may not have sufficient permissions to write to the server's file
system...

What ASP.NET can't do is work with the client browser's file system, at
least, not natively. If you're hoping to create a folder on the client's
hard disk, you're only option would be to write a Java applet or an ActiveX
control - not recommended...
Jan 6 '07 #5
Hi Mark,

Mark Rae wrote:
"André" <sv*@sdv.sdwrote in message
news:OJ**************@TK2MSFTNGP03.phx.gbl...
>Is it possible to create directories and files with asp.net?

Yes, with some caveats...

ASP.NET can use the System.IO namespace like any other .NET technology.
However, this will allow it to create files and or folders server-side, so
long as it has sufficient permissions to do so. Depending on how you have
your web app and/or IIS configured, the default account that ASP.NET runs
under may not have sufficient permissions to write to the server's file
system...

What ASP.NET can't do is work with the client browser's file system, at
least, not natively. If you're hoping to create a folder on the client's
hard disk, you're only option would be to write a Java applet or an ActiveX
control - not recommended...
Actually, with the right permissions, JavaScript also can manipulate the
FileSystem. There is no standard implementation in the browsers, so it's
a bit complex, but I use this in HTA applications running locally, it's
handy.

See
http://www.galasoft-lb.ch/myjavascri...rer/index.html

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 6 '07 #6
"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Actually, with the right permissions, JavaScript also can manipulate the
FileSystem. There is no standard implementation in the browsers, so it's a
bit complex, but I use this in HTA applications running locally, it's
handy.

See
http://www.galasoft-lb.ch/myjavascri...rer/index.html
Oh come on, Laurent! Of course you can "try" to run client-side scripting,
but who in their right mind is going to allow that to proceed, especially on
a public website!!!

The first thing this did was throw an "Automation server can't create
object" error - a quick glance at the line which threw the error revealed it
to be:

var fso = new ActiveXObject( "Scripting.FileSystemObject" );

Do you honestly think I was going to allow any client-side script beginning
with that line to continue to run...?

:-)
Jan 6 '07 #7
Hi Mark

Mark Rae wrote:
Oh come on, Laurent! Of course you can "try" to run client-side scripting,
but who in their right mind is going to allow that to proceed, especially on
a public website!!!

The first thing this did was throw an "Automation server can't create
object" error - a quick glance at the line which threw the error revealed it
to be:

var fso = new ActiveXObject( "Scripting.FileSystemObject" );

Do you honestly think I was going to allow any client-side script beginning
with that line to continue to run...?

:-)
Of course you weren't ;-) But then you also won't allow a Java applet or
an ActiveX to do that either, right? This was only in reaction to the
"Java or ActiveX" comment in your post.

My point is: JavaScript can be used for other things than over http. I
use HTAs often because they're easily programmed, because I love writing
JavaScript code and because using JavaScript to automate Excel, Outlook,
etc... is really much nicer (to me) than using VBA.

(in case you don't know, you can save any HTML with a HTA extension. It
will then run on any Windows PC with IE installed with the same rights
as a normal EXE application).

Friendly,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 6 '07 #8
"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:uM**************@TK2MSFTNGP02.phx.gbl...
Of course you weren't ;-) But then you also won't allow a Java applet or
an ActiveX to do that either, right? This was only in reaction to the
"Java or ActiveX" comment in your post.
I might, if I'd been notified of it in advance, and it was properly signed
by someone I know and trust - but I'd have to know and trust them a great
deal... :-)
My point is: JavaScript can be used for other things than over http. I use
HTAs often because they're easily programmed, because I love writing
JavaScript code and because using JavaScript to automate Excel, Outlook,
etc... is really much nicer (to me) than using VBA.
Indeed.
(in case you don't know, you can save any HTML with a HTA extension. It
will then run on any Windows PC with IE installed with the same rights as
a normal EXE application).
Yes - that can be useful if you don't care about cross-browser
compatibility...
Jan 6 '07 #9
Hi,

Mark Rae wrote:
"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:uM**************@TK2MSFTNGP02.phx.gbl...
>(in case you don't know, you can save any HTML with a HTA extension. It
will then run on any Windows PC with IE installed with the same rights as
a normal EXE application).

Yes - that can be useful if you don't care about cross-browser
compatibility...
I only use HTAs for small utilities, and I don't usually distribute
them, so it's OK.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 7 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nicholas | last post by:
I have this class that provides a disk-based queue for storing various items. As items are queued the event delegate is called and the consumer dequeues the object and processes it. This seems to...
7
by: SpookyET | last post by:
/FooProject /bin (release) /doc /src (only *.cs) /temp (obj files) /test (debug) /build /Visual Studio 2003 /Visual Studio 2005
5
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project...
2
by: ToddLMorgan | last post by:
I'm trying to set any of the dates (create, modification, access) of a directory under windows with python. I'm trying to do this as I'm trying to write a unittest for a directory cleaning...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
1
by: Gene | last post by:
I would like to know if the following is even possible with the visual studio.net Setup and Deployment project. 1. During the deployment after creation of application directory the setup needs...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
28
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
6
by: tgnelson85 | last post by:
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.