Silverlight / WPF - why silverlight application work in if it is localhost in a url link ?

Asked By Aravind Aravind on 20-Jan-14 08:49 AM
why silverlight work if it link have locahost(http://locahost/website/company.aspx)
if i try to change locahost to ip address or machine name like (http://192.168.0.4/website/company.aspx) or (http://admin-pc/website/company.aspx)it will not work.
 
 
Robbe Morris replied to Aravind Aravind on 20-Jan-14 07:41 AM
Is IIS running and do you have it configured properly to integrate with Visual Studio?

Not sure what version of visual studio you are running but if it is older than 2013, the default is the cassini web server not IIS.  It isn't designed by default to be accessed by remote machines or by ip address.
Aravind Aravind replied to Robbe Morris on 20-Jan-14 10:17 PM
hi,i am use vs2012 sp 1,if localhost work,but if ip or machine name not work. and tell me configured properly to integrate with Visual Studio ?


my website in iis i.e C:\inetpub\wwwroot in this folder i have website,and other things correctly work like login,some ordinary functions like insert data into db and retrieve,for get folder path in asp.net cant do,so we use silverlight ,get folder path only i did in silverlight in silverlight application with enable Equivalent trust and OOB and just use .xab file form client bin in website.
Robbe Morris replied to Aravind Aravind on 21-Jan-14 09:26 AM
Your English is very poor and difficult to understand.

Is the issue that the Silverlight app won't launch at all or are you attempting to access folders on your hard drive from within Silverlight? 

If it is the latter...

Silverlight runs in a sort of "security sandbox" in the browser.  One of the many things you are not allowed to do is access the hard drive in any way other than to permit a human to initiate a file upload just like a typical html file upload works.  That's it. 

So, if you are trying to access the hard drive on the client for anything else in a real world app, you can't do this in Silverlight.
Aravind Aravind replied to Robbe Morris on 22-Jan-14 10:15 PM
thank u for ur reply,i am use to try ip address and machine name instead of localhost  in server machine only  to get folder structure in treeview,form client machine i am disable that page,so from client machine cant access that page,
i am develop silver light separately with OOB and check Require elevated trust option and use .xab file in my website. we can run website with 3 types url link

1).http://localhost/smaple/company.aspx   ------Here can get folder structure in treeview
2).192.168.1.2/smaple/company.aspx   ------Here can not get folder structure in treeview
3).Admin-PC/smaple/company.aspx    ------Here can not get folder structure in treeview

why 1st only work other 2 not work ?

Access folders on your hard drive from within Silver light?  --- yes, bcz in asp.net we cant get folder path so only i use silverlight. Silverlight runs in a sort of "security sandbox" in the browser.  means what how to give ?
And i am not upload any file in server machine,in server machine itself need to get directory structure in treeview
Robbe Morris replied to Aravind Aravind on 23-Jan-14 08:44 AM
Read this thread:

http://stackoverflow.com/questions/3479162/system-io-fileinfo-throwing-access-is-denied-exception-to-a-local-file
Aravind Aravind replied to Robbe Morris on 23-Jan-14 10:12 PM
Hi pls read my recent post,in that i mention if url like localhost/sample/company.aspx it woks fine ,i.e i get folder structure in tree-view ,but if i use url like 192.168.4.3/sample/company.aspx or Admin/sample/company.aspx in server machine itself i cant get folder structure.i am try in server machine itself.
Robbe Morris replied to Aravind Aravind on 23-Jan-14 11:42 PM
Yes and that thread attempts to shed some light on it for you.  When you run your code in Visual Studio, it typically runs under your developer account which is probably an administrative account.  By default, browsing via IIS runs under a different windows account for that application pool in IIS.  It most likely does not have the required permissions.

You are not going to be able to use Silverlight to read client side folder structures unless you create extended priviledges on each user's machine.
Aravind Aravind replied to Robbe Morris on 26-Jan-14 10:08 PM
Hi,thank u for ur reply ,Actually i am not run in developing machine.i am publish website and deploy in SERVER machine,and if i run in server machine itself as localhost it work,but if use ip address or machine in server machine it not work.

NOTE: I AM DEPLOY IN SERVER MACHINE ,FROM SERVER MACHINE I WILL RUN AS LOCALHOST IT WORK,IF IT IS IP ADDRESS OR MACHINE NAME NOT WORK.

i am not run using Visual Studio,i am publish website and deploy in SERVER Machine(IIS).
In silver light application i give OOB,Evaluate Trust option form application properties