[Mono-list] Opening a file from .aspx

Tymoteusz Majewski tymoteuszmajewski at yahoo.com.au
Tue Jul 20 07:36:30 EDT 2010

Hello gurus,

This is on ubuntu, Mono JIT compiler version

I have mono setup which I can run c# scripts properly, but I cannot open files. 

            string file = "Config/1.txt";
            file = Server.MapPath (file);
            File.Open (file, FileMode.Open);

Access to the path "/MyPages/website/Config/1.txt" is  denied.

The file is accessible through apache, meaning I can go to 
"" and I can read the file.

If I run the same code from a mono app (not from .aspx page) it works fine.

I read quite a lot about trustLevels, securityPolicy in web.config files, but 
things just don't seem to have any effect.
When I tried to establish the current policy level from the page itself it 
reports as Unrestricted which is an issue on its own, but that's an issue for 

I tried to find something about trust levels in mono asp but I cannot find 

The bottom line is I would like to:
a) open and read a file from within the website's directory.
b) open and read a file from a specified directory not in the application's dir  
(website's root dir).

Thank you in advance.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100720/026622d3/attachment.html 

More information about the Mono-list mailing list