WriteFile in shared hosting
<p>I have the next code, which executes inside an iframe and forces a file download:</p>

<pre><code>System.IO.File.Copy(cnx.dataReader.Item("physical_path"), Server.MapPath(outputpath), True)
Response.ContentType = cnx.dataReader.Item("mimetype")
Response.AppendHeader("content-disposition", "attachment; filename=" &amp; cnx.dataReader.Item("name"))
Response.WriteFile(Server.MapPath(ruta_outputpath))
Response.End()
</code></pre>

<p>This used to worked a few weeks ago but now I get an error related to security policy (it's a shared hosting, but I repeat, it was working before, they swear they didn't change anything. This is the complete error:</p>

<pre><code>Security Exception
Description: The application attempted to perform an operation not allowed by the     security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +61
System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) +164
System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) +10
</code></pre>

<p>Is this a problem with trust level or similar? do you know a solution for working in a shared hosting?</p>

<p>Thank you</p>

<p>PS: sorry if there's a solution already somewhere, my internet connection this days is very slow so I my search was "reduced", thank you</p>
