i want to stream online videos ..but i am facing j query error Not allowed to load local resource: ...i find many solution but that all did not work for me. he
I had the same problem. Whenever I used Server.MapPath
or Path.GetFullPath
or just hardcoded "~/Content/images/image.jpg" I always got the same error Not Allowed to load local resources.
The only way it was working for me is when I used "Content/images/image.jpg" without the
~/
at the beginning
So my workaround was like this
var imageName = Path.GetFileName(image);
var parentImage = Directory.GetParent(image);
var parentOrder = Directory.GetParent(parentImage.FullName);
var parentDate = Directory.GetParent(parentOrder.FullName);
It is a little messy but it worked for me. Alternatively, you can also pass in the Variable path in a ViewModel to make a little cleaner code.
If someone knows for a better solution please post it here so people will know the correct Answer.