Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body

iam the started of silverlight

this is my code

C#
string path = @"F:\MyTest.txt";
                if (!File.Exists(path))
                {
                    // Create a file to write to.
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine("Hello");
                        sw.WriteLine("And");
                        sw.WriteLine("Welcome");
                    }

                }



so iam creating a text file but it's return error
SQL
[FileSecurityState_OperationNotPermitted]
Arguments: F:\MyTest.txt
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.60401.00&File=mscorlib.dll&Key=FileSecurityState_OperationNotPermitted



can i know wehre i worng?

thanks and advance................
Posted
Updated 25-Apr-12 22:56pm
v4
Comments
lukeer 26-Apr-12 2:56am    
"OperationNotPermitted" means that the code isn't granted the right to create a file at the location you wanted it to.

Speculation: Silverlight sounds like web stuff. Maybe that is generally not allowed to interact with the file system. Maybe it is only allowed to use temporary files.
Bojjaiah 26-Apr-12 3:01am    
Is there any way?
[no name] 26-Apr-12 6:31am    
You have to run your Silverlight app in Full Trust mode. Then when you deploy your app you have to get your users to create a security hole on their system by granting you application Full Trust. Not too many are going to want to do that.

1 solution

Well, I never programmed a Silverlight app before, but in my understanding, a Silverlight app shuold not be allowed to access the filesystem on client side because of security reasons.

Do you want to start programming in Silverlight or do you want to start writing apps in C# or both at the same time?
 
Share this answer
 
v2
Comments
BO@007 26-Apr-12 2:57am    
local system also notworking..........
Bojjaiah 26-Apr-12 3:01am    
Is there any way?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900