none
Accees Server Folder

    Question

  • I want to host my silverlight application on my server. my silverlight App takes images from one of the folders from the server.

    But when I am trying to access the folder it is giving access denied error.

    My silverlight app may be ebmedded in any other web site. But it will always take folder path from the server where I am hosting the app. Please note I  do not want to access user's local folder rather want to access a folder of the server where the silverlight app is hotsed.

    What is the best approach to do this.

    -Thanks 

    Saturday, October 29, 2011 5:59 AM

Answers

  • my silverlight App takes images from one of the folders from the server.

    Silverlight cannot get the images by "C:\" and can get the images by "http://"

    So just host the images folder to a iis with access to the images folder.

    http://support.microsoft.com/kb/812614

    Then you can get the images.

    Monday, October 31, 2011 1:32 AM

All replies

  • my silverlight App takes images from one of the folders from the server.

    Silverlight cannot get the images by "C:\" and can get the images by "http://"

    So just host the images folder to a iis with access to the images folder.

    http://support.microsoft.com/kb/812614

    Then you can get the images.

    Monday, October 31, 2011 1:32 AM
  • But when I am trying to access the folder it is giving access denied error.

    yes you can access the images deployed along with silvelright application from client system, for this you have to give permisions to the image folder, By adding "Service" user and unchecking the readonly property.

    Monday, October 31, 2011 1:46 AM
  • I use ria services to access my databases and to store/access image files on my localhost server. This all seems to work. When I publish the site to my local IIS server I can access my databases, but the file upload/download does not work. The localhost mode stores the files in a directory named Services, and I provide the rest of the path and file name. Visual Studio chose the Services folder automatically for the localhost.

    In my wcf ria service, I set my path as follows:

    filePath = HttpContext.Current.Server.MapPath(".") + ConfigurationManager.AppSettings[fileLocation] + year + "/" + month + "/";

    The above file path represents the following physical path:

    SMMApp.Web\Services\Pictures\KY\2011\10   The Services folder was automatically created by VS2010 in the project directory, but not added to the project itself. When I published the site, the Services is not created/published with the site since it is not in the project.

    I am sure that I am missing something, but I haven't been able to find any help on the web yet. Any ideas or links.

    Thanks,

    Warren

    Wednesday, November 02, 2011 1:33 PM
  • The technique that I used to upload/access files on the server are described in the following links:

    by user amyo…

    http://social.msdn.microsoft.com/Forums/en-US/silverlightnet/thread/4a18ae45-509d-40ff-a4b7-1d8f000e2fb8//1/10

    by Priya Linge…

    http://www.c-sharpcorner.com/UploadFile/0d4efc/8800/

    As to my issue of running on localhost versus a local instance of IIS 7, there were several things that I had to do to get it to work.

    1. I tried setting read/write privileges for the virtual folder using IIS manager and on the physical folder on my hard drive, but this did not work. I also discovered that a try/catch block that I had added to debug the original service code was blocking an exception that was being thrown in my wcf ria service. It was an access exception.

    To get the local IIS service working with file access I had to do the following.

    2. Added the App_Data folder to my web project to act as the store for my files.

    3. Deleted the virtual directory and the contents of the physical location of my web project. I think it may have been corrupted earlier by something that I had done.

    4. Recreated the virtual directory from VS.

    5. Used IIS Manager to give read/write access to the "virtual' App_Data folder (still got an exception at this point, but the application was able to create the App_Data folder on my physical drive).

    6. Used Explorer to set read/write access to ‘Everyone’ for the physical App_Data folder.

    7. Verified that the application was able to read/write/delete from the physical folder using my local IIS server.

    Thursday, November 03, 2011 8:33 AM