Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

ASP.NET c# code for creating a folder on remote webserver from an web application in localhost

Posted on 2014-03-08
Last Modified: 2016-05-18
One of my web applications written on ASP.NET C# code running from my local system (of course of internet on) requires a subfolder to be created e.g Info_Attachments folder located in the wwwroot folder of mysite. I know the IP address of webserver of my website.
Is it possible? If so, how should I go about
Question by:smanthanims
  • 3
  • 3
LVL 25

Expert Comment

ID: 39920189
Is it going to a dynamic folder, for different users ?

Author Comment

ID: 39924655
Yes. It is a dynamic folder with name unique to a record. For e.g. Combination of date,primary key and random number and the folder name will be as 20140215_106_587402. I do not understand by what you mean by 'for different users'?
LVL 25

Expert Comment

ID: 39926015
Different users mean, different users who login into your site.

It is always good to create folder under your site.  
Basically to create a folder you should give the IIS_user the permission to create folder. Or you should impersonate the user only for this functionality of the code.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Author Comment

ID: 39926947
I will be running the code on my local system with internet connected.
Folders are created through code from admin module from a single user. When we normally create, we use the following code (ASP.NET in C#)
. string NewDirectory = Server.MapPath("~/Info_Attachments/" + strosrfld + "/");
                             if (!Directory.Exists(NewDirectory))
Assume the IP of the web server is and I know the main directolry (d:) and other folders leading my website folder till Info_Attachments folder into which I wish to create the dynamic folders with unique name (strosfld which is dynamic and unique). How should I replace the Server.MapPath. Of course, I will create write permssions of the folder Info_Attachments from the web control panel
LVL 25

Accepted Solution

apeter earned 500 total points
ID: 39988260
Go to the folder "Info_Attachments" in windows explorer, right click on it and in security tab give permission to the "web Site user" write pemission. To test this with,  you can try by write permission to every one.

Author Comment

ID: 39990502
Thanks. I will check and get back

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question