[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 2.4.2.3

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

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

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

The file is accessible through apache, meaning I can go to 
"http://192.168.1.125/Config/1.txt" 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 
later.

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


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.

Thanks
Tymek


      
-------------- 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