Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
| Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 4th, 2005, 05:33 AM
Authorized User
 
Join Date: Dec 2004
Location: Salo, Loimaa, , Finland.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eelisMX
Default Security permissions of file

Hi

I'm trying to check a file for its security permissions to determine if it is writeable or not.
The code looks like that:
Code:
Function IsFileWritePermission(ByVal sFileName As String) As Boolean
        Try
            Dim fp As FileIOPermission
            fp = New FileIOPermission(FileIOPermissionAccess.Write, sFileName)

            fp.Demand()

            Return True
        Catch ex As Security.SecurityException
            Return False
        Catch ex As Exception
            Return False
        End Try
    End Function
The file i'm testing has a Deny Write permission and the function still return true. If I try to open the file to write, it raises an error exception for write permission.

Thanks.


Similar Threads
Thread Thread Starter Forum Replies Last Post
File permissions windows 2000 rasheed.akr ASP.NET 1.0 and 1.1 Professional 0 September 15th, 2008 01:45 AM
Permissions on DB without user-level security nbourre Access VBA 4 June 7th, 2008 08:09 AM
Network File Permissions Pope ASP.NET 1.0 and 1.1 Professional 2 January 12th, 2006 12:42 PM
System.Security.Permissions.SecurityPermission jshae VB.NET 2002/2003 Basics 6 November 4th, 2004 02:16 AM
File Permissions rwalker ASP.NET 1.0 and 1.1 Basics 5 April 20th, 2004 12:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.