Bahman Posted February 3, 2007 Share Posted February 3, 2007 -------------------------------------------------------------------------------I would like to determine whether or not a given folder in my server has write permission or not. I used fso object option and used Attributes object bur always I get number 16, regardless if it has write permission, read permission or nothing at all. What is the correct object that gives me that information. Currently, I have the following code to display information on the folder:Set fso = CreateObject("Scripting.FileSystemObject") Set a = fso.GetFolder(Server.MapPath("\") & folder_directory)Response.Write ("Attributes: " & a.Attributes & "<BR>") Link to comment Share on other sites More sharing options...
justsomeguy Posted February 6, 2007 Share Posted February 6, 2007 The attribute value of 16 indicates that the object is a folder. This is the list of attribute values: 0 = Normal file1 = Read-only file2 = Hidden file4 = System file16 = Folder or directory32 = File has changed since last backup1024 = Link or shortcut2048 = Compressed file Link to comment Share on other sites More sharing options...
Bahman Posted February 10, 2007 Author Share Posted February 10, 2007 How do capture error related to write permission?I try to delete a folder that does not have write permission, theregfore I get error and error messages. I would like to avoid receiving error message on screen and continue deleting other folders. I have been told I need to capture the error and do some checking there. How do capture error related to write permission? Link to comment Share on other sites More sharing options...
jesh Posted February 13, 2007 Share Posted February 13, 2007 How do capture error related to write permission?I try to delete a folder that does not have write permission, theregfore I get error and error messages. I would like to avoid receiving error message on screen and continue deleting other folders. I have been told I need to capture the error and do some checking there. How do capture error related to write permission?In javascript, java, and C#, you'd use a try/catch(/finally) block. It'd look something like this:try{ // do some code here that may cause an error}catch(Exception e){ // handle the exception (error) here.} Perhaps there's something like that in VB as well.EDIT: Found this link: http://msdn2.microsoft.com/en-us/library/f...6tz(VS.80).aspx Link to comment Share on other sites More sharing options...
aspnetguy Posted February 13, 2007 Share Posted February 13, 2007 Try myFunction()Catch ex As Exception Response.Write("There was a problem")End Try Link to comment Share on other sites More sharing options...
packrat Posted February 14, 2007 Share Posted February 14, 2007 or in classic asp vb script: on error resume next 'some code if err.number <> 0 then 'handle error end if on error goto 0 error handling is pretty ugly in vb6 / vbscript Link to comment Share on other sites More sharing options...
justsomeguy Posted February 14, 2007 Share Posted February 14, 2007 error handling code is pretty ugly in vb6 / vbscript sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now