Security & Access Control in Classical ASP

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 5
Reputation: nitin_rajurkar is an unknown quantity at this point 
Solved Threads: 0
nitin_rajurkar nitin_rajurkar is offline Offline
Newbie Poster

Security & Access Control in Classical ASP

 
0
  #1
Oct 15th, 2009
Hi All,
I have a typical problem. We have established product developed in ASP. Now I want to add security and access cotrol to upload directory and files. I could not find anything that can help me to write code in ASP. But in ASP.net C# and C++ there is lot. By comparison, I wrote in ASP something like this:

Public Sub AllowAccess(FullPath, UserNameForFullAccess, Access_Mask)
Dim oFileSecurity, oFile
oFile = oFile.FileInfo(FullPath)
oFileSecurity = oFile.GetAccessControl()
if (len(trim(UserNameForFullAccess)) > 1 ) then
if (len(Access_Mask)>1) then
select case Access_Mask
case GENERIC_ALL
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
case GENERIC_EXECUTE
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.ReadAndExecute, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
case GENERIC_READ
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.Read, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
case GENERIC_WRITE
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.Read, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.Write, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
case FILE_ACCESS_ALL
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
case MAXIMUM_ALLOWED
oFileSecurity.AddAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForFullAccess, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
end select
end if
end if
oFile = Nothing
oFileSecurity = Nothing
End Sub

Public Sub RevokeAccess(FullPath, UserNameForDeniedAccess)
Dim oFileSecurity, oFile
oFile = FileInfo(FullPath)
oFileSecurity = oFile.GetAccessControl()
if (len(trim(UserNameForDeniedAccess)) > "") then
oFileSecurity.RemoveAccessRule(New System.Security.AccessControl.FileSystemAccessRule(UserNameForDeniedAccess, System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow))
oFile.SetAccessControl(oFileSecurity)
End if
oFile = Nothing
oFileSecurity = Nothing
End Sub

This code fulfills my need but problem is this does not work in ASP. Can somebody help me how can I achieve this in ASP?

Nitin Rajurkar
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,146
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator
 
-7
  #2
Oct 15th, 2009
I take it you are using IIS?
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 5
Reputation: nitin_rajurkar is an unknown quantity at this point 
Solved Threads: 0
nitin_rajurkar nitin_rajurkar is offline Offline
Newbie Poster
 
0
  #3
Oct 16th, 2009
Hi Jbennet,
You are right. I am using IIS and Internet Explorer 6.0 and above. I created ActiveX and accessing these through it.

Any simple solution you have?

Nitin
Reply With Quote Quick reply to this message  
Reply

Tags
access, control, files, security, users

Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC