Give access to non virtual folder through configuration entry? ERROR: path attribute must be a relative virtual path. It cannot contain any of '?' ':' '' '*' ''' '<' '>' or '|'.

I have a webpage running under a virtual directory that is mapped to d:/webapplication that produces an excel spreadsheet, the page calls a library object that generates a report and places it in a folder d:/attachments. This folder is not in the virtual directory. When I access the webpage i click a button and it attemps to return the created spreadsheet as a mim content type application/vnd.ms-excel.

However i getting redirected back to the login page of the application. Ive also noticed that the excel spreadsheet has not even been created at this location. So assuming this was an authoriseation problem (i.e. I was not authorised to get access to the d:/attachments folder from the web client) I added the following to the web.config at the end.


  
   
    
   

  

 

However I get the following error

  path attribute must be a relative virtual path.  It cannot contain any of '?' ':' '' '*' '"' '<' '>' or '|'.

Is this accurate? Can I only give access for the web application process to folders in a virtual directory? I have granted access rights to everyone to this folder (just because I was too lazy to find the actual user accout that the website is operating under) and I can still not get access.

 I guess the brunt of the question is: Is there a way to grant access to a file from a web application that if that file is not in a virtual directory?

Or is there something I am missing. Any help would be much appreciated.

Regards,

Pete


Peter Heard
0 peter_heard01 1/29/2009 4:53:44 PM

 Hi,Pete

 

peter_heard01:
So assuming this was an authoriseation problem

 It is not an Authorization problem. and even if it is a problem of Authroization, the code should be like this :


  
   
    
   

  

 

 

peter_heard01:
 I guess the brunt of the question is: Is there a way to grant access to a file from a web application that if that file is not in a virtual directory?

According to your description, I think it is the problem, ASP.NET app runs under Network Service account by default(without impersonation).Network Service Account do not have the write permission to folder expect the "App_Data" folder.Therefore, what you need to do is grant Network Service Account write permission to the attachments folder whatever it is or not in the virtual directory.

To grant Network Service Account write permission, following these steps:

    1. Right click the folder, choose Properties, click security tab.

    2. Click "Add" button in the "Group or user name" section.

    3. Type in"Network Service " and click "Check Names" button. Click "OK".

    4. Under "Permissions to NETWORD SERVICE" select write allow check box.

If there is anything not clear, please post here, and let me know the result.

Regards

Andrew Zhu


Andrew Zhu
Microsoft online ASP.NET support
Please remember to click €œMark as Answer€ on the post that helps you. This can be beneficial to other community members reading the thread.
0 Andrew 2/3/2009 12:54:25 AM

peter_heard01:

However I get the following error

  path attribute must be a relative virtual path.  It cannot contain any of '?' ':' '' '*' '"' '<' '>' or '|'.

Is this accurate? Can I only give access for the web application process to folders in a virtual directory?

 

Peter as you guessed, you can only reference to the virtual paths using the location tag.

Now to get to your actual issue, what error are you getting when you are saving the file into that d:/attachments folder

If you are running your application in IIS 5.0, then you need to give ASPNET user, the write permissions to that folder

If its IIS 6.0, its the NETWORK SERVICE.


Kumar Reddi
0 Kumar 2/3/2009 2:46:48 AM
Yeah after messing around with this still not possible to give access in this way. I opened to 'everyone' and it didnt work.  Seems Asp.net will only serve files out to the web that are configured in IIS. The asp.net worker process can still read and write to a file but will not serve to external requests....im pretty sure you have to stick it in a web directory now unless you could copy it locally first maybe i didnt try that....
Peter Heard
0 peter_heard01 2/12/2009 10:09:47 PM
Reply:

(Thread closed)