Nick Zachariasen
Nick Zachariasen

Reputation: 51

ASP.NET/C#: Sending form output to a network folder

I have an ASP.NET/C# web form for making personnel action requests for the IT department to act on. It outputs via email, formatted as HTML to increase readability. However, I'd like to expand this to include general HR information because much of it is redundant with what the requester would already be sending to HR anyway, resulting in duplicate information. Given the presence of information like SSNs, though, I'd really rather not email this information, partly because our system flags that kind of content.

Given this, is it possible to somehow send the form data as a file (in whatever format— I'd imagine PDF— and preferably more reader-friendly than plain text) output to a network folder, ideally along with sending the non-sensitive information in am email to then be forwarded to us? I know you can access network folders in ASP.NET (not that I've done it, mind you), but I don't know if you can dump form output to a file the way I'd like to do it.

Upvotes: 0

Views: 70

Answers (1)

Alan McBee
Alan McBee

Reputation: 4320

The short answer is yes, as long as you have your ASP.NET Web application running with an account (the application pool identity) with sufficient permissions to write to the network share you want to save the file to, you can do this.

A common method is to set up a distinct application pool just for your one web application, and to configure it to use a domain account that is provisioned exclusively for this use. (Some people call them faceless account or system accounts.) Make sure to grant write permissions to the network share where you want to save the files.

Then, use regular System.IO .NET classes to save the files to the network share. There are countless examples of this, so you should easily find one close to what you need.

Upvotes: 1

Related Questions