Solved

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

Posted on 2014-03-08
10
49 Views
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
0
Comment
Question by:smanthanims
  • 3
  • 3
10 Comments
 
LVL 25

Expert Comment

by:apeter
Comment Utility
Is it going to a dynamic folder, for different users ?
0
 

Author Comment

by:smanthanims
Comment Utility
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'?
0
 
LVL 25

Expert Comment

by:apeter
Comment Utility
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.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:smanthanims
Comment Utility
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))
                {
                Directory.CreateDirectory(NewDirectory);
                }
Assume the IP of the web server is
51.98.219.198 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
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
Comment Utility
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.
0
 

Author Comment

by:smanthanims
Comment Utility
Thanks. I will check and get back
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 learn how to count occurrences of each item in an array.

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now