1

I am currently using App_data to store the dynamically created PDFs, Finding full path using:

String Location = AppDomain.CurrentDomain.GetData("DataDirectory").ToString();

However, ASP.NET MVC3 doesn't allow me to embed from this location. with 403 problem.

<embed src="@Url.Content("~/App_Data/test.pdf")"  width="100%" height="500px" />

Researching, this is the desired of the App_data folder.

  1. So, how can I embed from this directory. or is there a better directory for this? I can access it fine from Content folder, but it seems the wrong place. (and how would I get the absolute path for the given folder)

  2. What is the App_Data folder for???

IAmGroot
  • 13,760
  • 18
  • 84
  • 154

1 Answers1

2
  1. You can't embed directly from this folder as you've found. You can either create a temp folder in your content folder that you deliver the PDFs from (open to discoverability, and therefore not what I'd recommend) or you can write a handler that streams the document from the App_Data folder (which is what we do for a similar problem, except we use the OS's temp folder) and reference that.

  2. There are good answers in this question here

Community
  • 1
  • 1
nickd
  • 3,951
  • 2
  • 20
  • 24