In Silverlight 5, how to get Directory name of a file without Running application Out Of Browser? - silverlight

In Silverlight 5, I am performing File operations using Open File Dialog. I want to read the Directory Name of the selected file from the Open File Dialog box. But I am getting error "File operation not permitted. Access to path '' is denied." How to solve this issue ?
It is working fine when I opt for "Running application Out Of Browser with elevated trust". But I don't want to run my app outside of the browser. So my problem is to get the Directory name of the selected file without making application to run out of browser. Please help!

You could try to run Silverlight 5 in the browser with elevated trust.
This is no guarantee that it will work because the Silverlight app will still be subject to the restrictions imposed by the security settings of the browser.

Related

Tizen cannot create file in native service application

I am developing a wearable application for Samsung Gear Fit 2 in Tizen 2.3. The app is hybrid type, where I need to write the sensor data obtained in native application into a file. However, file pointer is null and new file is not created. 'errno' shows the message "Permission Denied". I have checked the permissions for creating file. Also, the same code runs perfectly on Gear S2 without any error
Have you set right permissions ? and in which path are you writing ?

Where does Android Studio hide upload permissions for an app engine project?

I had a working app engine project (Java) which I had created from a template some time ago. The upload always worked fine and I don't remember that I had entered credentials when I set it up. Well, probably I did at some point, but I don't remember what the mechanism was.
Now I switched the project to another app engine project which also has a different admin user. I changed to the new application-name-000 in appengine-web.xml and started the upload, but gradle/appengineUpdate keeps telling me this:
Oct 20, 2014 10:06:35 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=application-name-000&version=2&
404 Not Found
This application does not exist (app_id=u'application-name-000').
Sure the application does not exist, because it's a new project for app engine ;-) I tried to set version 2 to version 1 temporarily which doesn't seem to be the problem. I googled and found out it seems to be a permission problem, but I can't find any hint what I need to do or where I can set the new permissions in Android Studio.
What is the process? Will I need to copy some key from app engine into the project, or where can I set my username/oauth whatever in Android Studio?
I finally found out how to fix this. And yes, it is a permissions problem (see proof further below).
Android Studio uses oauth to connect to the project to app engine. When you install Android Studio and then create the project the first time, it creates the following file in your home directory:
.appcfg_oauth2_tokens_java (in Windows this is under c:\Users\{Username}\)
This is a file with no name and just an extension. This file contains the token to connect and upload to app engine.
If the oauth user changes, Android Studio uses the wrong credentials and the upload fails.
To solve the problem:
Delete the file.
Call appengineUpdate from the command line (!), not from the menu (in Windows, you typically open the Terminal from within Android Studio and from within your module, then enter
..\gradlew appengineUpdate
It starts the update and due to the missing file, Android Studio pops open your browser where you select your Google user and give permissions. You then receive a code.
Copy that code and paste it into the Terminal. There is no input box or anything. The command line just stops and says nothing. Paste your code there and press enter.
A new file will then be created for you, the token saved to the file, and your project should upload fine.
The hint to the file I found here http://code.google.com/p/googleappengine/issues/detail?id=8300 and the hint how to copy the code was here http://code.google.com/p/qt-google-calendar/issues/detail?id=2 (awful, Google).
That it was a permissions problem could be seen, when I changed my build.gradle file:
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
oauth2 = true produced this error message:
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=...&version=2&
404 Not Found
This application does not exist (app_id=u'...').
while oauth2 = false produced this one:
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=...&version=2&
401 Unauthorized
Must authenticate first.
What do we learn? Never trust an error messages, no matter how explicit it seems to be.
You can simply change the password on the first account and when you try to run appengineUpdate it will prompt you for new account details.

How to get file in Silverlight Application?

Suppose, we have a sivlerlight application - SLApp. SLApp is located on the WebSite someweb.com. Link on file likes this - someweb.com/SLApp?URL="https://smthg.com/file.exe" .
How to get this file in the silverlight app&
It's difficult to understand what you want from your question:
For getting a file from the client machine and sending it to the server:
You can't do that directly, it's a security risk, and hence disabled. You can only access files via the file open dialog.
For getting a file from the server to the client:
Now if you are wanting to download a file to the client via a link, then you can just open a web page with the link/url, that way you use the standard browser functionality.

Problem with navigateurl in silverlight to a UNC path

I have a problem with a command button (implementing the ICommand). I want, when pressing the specified button to redirect the user at new tab targeting a UNC path.
HtmlPage.Window.Navigate(new Uri(#"\\host\filename"), "_blank");
The problem is that browser redirects the user to the following target, besides of my intention:
http://www.hostnameoftheslapplication.com/\\host\filename
How can I achieve the correct navigation;
Thank you in advance.
What you are trying to do is not allowed in Silverlight. HTML navigation is for opening web pages from web servers, but the UNC syntax you are providing is for file system access. Silverlight only allows extrememly limited access to the filesystem of the client PC.
To be able to serve up your file, you could configure your web server so that the "host" path was a virtual directory within your web application. Then you could use relative URI syntax to serve up the filename rather than UNC syntax.

Launch Error in Expression Blend 2

I get an exception error when I F5/Build any Silverlight project within Expression Blend 2:
Launch Error
Could not start ""
due to the following error: System.ComponentModel.Win32Exception: The
system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.Expression.Project.ExecutableProjectBase.Execυte()
Googling seems to suggest it can be an incorrectly configured dev server.
Here's a Blend Configurator
Here's the post that let me to it
If this doesn't help try the following:
Remove the Silverlight project reference in your web app's properties pages, rebuild, add it again.
Ensure the virtual directory or other path your web app is running under (Project URL: http://localhost/mysilverlightapp for example) actually gets you to it. Hit 'Create Virtual Directory' if not. See if it does now.
Check that your page with the silverlight control has the correct file name for your Silverlight dll.

Resources