I am accessing XML files in a sub-directory DataXML. In JavaScript I am addressing them like this:
"../DataXML/fileName.xml"
and all is fine.
To avoid users seeing my data files I have moved them (the files not the users!) into the ASP.NET folder, App_Data, and now get an error message when I use the form
"../App_Data/fileName.xml" . I get the following message when I execute:
"Failed to load data from App_Data/fileName.xml. Forbidden."
I am using the Javascript library, Simile Timeline. Does your reply mean that I have to copy my XML file from App_Data into an available directory for processing by Simile, and delete it when unloading the page?
if you want to expose files to the browser then it's a nogo to put them in the App_Data as it's protected to be downloaded from another source.
What you can do however is to make a Web API that reads out the xml file, from the App_Data, and sends out the needed information to the widget. I didn't work with the widget myself yet but I noticed some ajax part in it so you could call your Web API with
that likely.
Member
3 Points
17 Posts
Problem with files in App_Data
Jul 25, 2014 01:43 AM|zermattbs|LINK
I am accessing XML files in a sub-directory DataXML. In JavaScript I am addressing them like this:
"../DataXML/fileName.xml"
and all is fine.
To avoid users seeing my data files I have moved them (the files not the users!) into the ASP.NET folder, App_Data, and now get an error message when I use the form
"../App_Data/fileName.xml" . I get the following message when I execute:
"Failed to load data from App_Data/fileName.xml. Forbidden."
TIA
All-Star
191721 Points
20949 Posts
ASPInsiders
Moderator
MVP
Re: Problem with files in App_Data
Jul 25, 2014 01:53 AM|XIII|LINK
Hi,
you can't expose these files to the browser but server side you should be able to get to them like this:
In the past you had to also add Current to that line like HttpContext.Current....
Grz, Kris.
Working with Azure, chatbots, ASP.NET MVC, Web API, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Member
3 Points
17 Posts
Re: Problem with files in App_Data
Jul 25, 2014 07:34 PM|zermattbs|LINK
FYI I had to add the "Current".
I am using the Javascript library, Simile Timeline. Does your reply mean that I have to copy my XML file from App_Data into an available directory for processing by Simile, and delete it when unloading the page?
Or is there a better way?
Or have I completely misunderstood??
Regards
Andrew McG
All-Star
191721 Points
20949 Posts
ASPInsiders
Moderator
MVP
Re: Problem with files in App_Data
Jul 26, 2014 06:14 AM|XIII|LINK
Hi,
if you want to expose files to the browser then it's a nogo to put them in the App_Data as it's protected to be downloaded from another source.
What you can do however is to make a Web API that reads out the xml file, from the App_Data, and sends out the needed information to the widget. I didn't work with the widget myself yet but I noticed some ajax part in it so you could call your Web API with that likely.
Update: been searching quickly in the documentation and there's a loadJSON function on the Timeline which you could likely use to call your Web API: http://simile-widgets.org/wiki/Timeline_LoadEventsDynamically
Grz, Kris.
Working with Azure, chatbots, ASP.NET MVC, Web API, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!