App_Data files

App_Data files

am 21.12.2007 23:25:07 von SushiSean

I have problems with sharing files from this directory. It is system
directory so I can't make dirrect links on files inside. For example
/App_Data/my.mp3
www.example.com/App_Data/my.mp3 - forbidden link

I have tring make a handker which should read this file and write to response
www.example.com/file.ashx?filename=my.mp3
But I have other problem with it. It can be different file and for any of
this I need to know
1) which Mime Content Type for this and
2) when it save it save with name of handler file file.ashx but it should be
my.mp3

So how I should make http links on files from App_Data.

ps. I use this App_Data folder for save my files only because it allow
create/remove directories without errors. If I remove some other folder
inside site - page as usual freezing

Re: App_Data files

am 22.12.2007 14:09:54 von l.holota

The App_Data folder is "invisible" for users, because it is supposed to
contain database or xml files - secret files users must not see. If you want
to create direct links, create your own folder ("mp3" for example) asp.net
will not control this folder and it will be available for users. Another way
you mentioned - handler, you can find the MIME type here:
http://www.w3schools.com/media/media_mimeref.asp. Don't know how to solve
the other problem with file name, someone else will advise :)

"SushiSean" wrote in message
news:2EEC7AE4-2EC9-4B34-A456-210D49B3DAAD@microsoft.com...
> I have problems with sharing files from this directory. It is system
> directory so I can't make dirrect links on files inside. For example
> /App_Data/my.mp3
> www.example.com/App_Data/my.mp3 - forbidden link
>
> I have tring make a handker which should read this file and write to
> response
> www.example.com/file.ashx?filename=my.mp3
> But I have other problem with it. It can be different file and for any of
> this I need to know
> 1) which Mime Content Type for this and
> 2) when it save it save with name of handler file file.ashx but it should
> be
> my.mp3
>
> So how I should make http links on files from App_Data.
>
> ps. I use this App_Data folder for save my files only because it allow
> create/remove directories without errors. If I remove some other folder
> inside site - page as usual freezing