Static server void MyServerFunction1()
{
// Declare the CAS Permission object.
FileIOPermission fileIOPermission;
TextBuffer txtb = new TextBuffer();
Filename filename ="D:\\myfilePK.txt";
// Assert that it is okay to read and write files and
// Clipboard because the content is coming from astatic file name.
fileIOPermission = new FileIOPermission(filename,
'rw');
fileIOPermission.assert();
// From file will demand CAS permission (read)
txtb.fromFile(filename); // Read text from file
// To clipboard will demand CAS permission (write)
txtb.toClipboard(); // Copy it to the clipboard
// To file will demand CAS permission (write)
txtb.toFile(filename); // Write text to file
}
{
// Declare the CAS Permission object.
FileIOPermission fileIOPermission;
TextBuffer txtb = new TextBuffer();
Filename filename ="D:\\myfilePK.txt";
// Assert that it is okay to read and write files and
// Clipboard because the content is coming from astatic file name.
fileIOPermission = new FileIOPermission(filename,
'rw');
fileIOPermission.assert();
// From file will demand CAS permission (read)
txtb.fromFile(filename); // Read text from file
// To clipboard will demand CAS permission (write)
txtb.toClipboard(); // Copy it to the clipboard
// To file will demand CAS permission (write)
txtb.toFile(filename); // Write text to file
}
No comments:
Post a Comment