469,929 Members | 2,104 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

Need help with checking file permissions.

We have web site that used the IIS ResKit tool MSWC.PermissionChecker to
check file permissions. The web site has been upgraded and that upgrade
included changing the default server side language from VBScript to C#
(*.vbs --> *.cs).

Does C# have a native method for doing what MSWC.PermissionChecker used to
do?
If so has anyone gone through converting the MSWC.PermissionChecker method
to C# and would they share what they did?
If not has anyone converted the MSWC.PermissionChecker vbs code to C# and
would they share what they did?

I have posted the old code (some wrapping did occur) hoping it may help you
help me. if more information is need just ask me.

Thanks!
Dan Rhoads

<head>
<%
'##### July 8, 2003 SEG, POPUP Window Based on /Groupmessages/default.htm
permissions
'##### Updated 02/19/2004 by Daniel W Rhoads, The Hartford, ISD Client
Engineering
'##### Fixed the window names so more than one popup can be opened at a time
'##### they were originally all set to 'newwindow'. Converted the popups
from standard
'##### IE windows to Modal Dialogs.

Dim objPC
Dim blnUserHasAccess

Set objPC = Server.CreateObject("MSWC.PermissionChecker")

'For each message you need to copy this code block. Edit the message number
and
'ensure the NFTS file permissions are correct for the file.
blnUserHasAccess = objPC.HasAccess("./GroupMessages/Message1.htm")
If blnUserHasAccess Then %>
<SCRIPT LANGUAGE="javascript">
var sFeatures="dialogHeight:425px; dialogWidth:400px; scroll:no;
status:no; help:no;";
//var sFeatures="dialogLeft:50px; dialogTop:50px; dialogHeight:425px;
dialogWidth:400px; scroll:no; status:no; help:no;";
window.showModalDialog("./groupmessages/Message1.htm", "", sFeatures);
</SCRIPT>
<% End If
blnUserHasAccess = objPC.HasAccess("./GroupMessages/Message2.htm")
If blnUserHasAccess Then %>
<SCRIPT LANGUAGE="javascript">
var sFeatures="dialogHeight:425px; dialogWidth:400px; scroll:no;
status:no; help:no;";
//var sFeatures="dialogLeft:150px; dialogTop:150px; dialogHeight:425px;
dialogWidth:400px; scroll:no; status:no; help:no;";
window.showModalDialog("./groupmessages/Message2.htm", "", sFeatures);
</SCRIPT>
<% End If %>
</head>
Nov 16 '05 #1
1 3077

"MSDN Account" <ni********@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
We have web site that used the IIS ResKit tool MSWC.PermissionChecker to
check file permissions. The web site has been upgraded and that upgrade
included changing the default server side language from VBScript to C#
(*.vbs --> *.cs).

Does C# have a native method for doing what MSWC.PermissionChecker used to
do?
If so has anyone gone through converting the MSWC.PermissionChecker method
to C# and would they share what they did?
If not has anyone converted the MSWC.PermissionChecker vbs code to C# and
would they share what they did?

I have posted the old code (some wrapping did occur) hoping it may help
you
help me. if more information is need just ask me.

Thanks!
Dan Rhoads

<head>
<%
'##### July 8, 2003 SEG, POPUP Window Based on /Groupmessages/default.htm
permissions
'##### Updated 02/19/2004 by Daniel W Rhoads, The Hartford, ISD Client
Engineering
'##### Fixed the window names so more than one popup can be opened at a
time
'##### they were originally all set to 'newwindow'. Converted the popups
from standard
'##### IE windows to Modal Dialogs.

Dim objPC
Dim blnUserHasAccess

Set objPC = Server.CreateObject("MSWC.PermissionChecker")

'For each message you need to copy this code block. Edit the message
number
and
'ensure the NFTS file permissions are correct for the file.
blnUserHasAccess = objPC.HasAccess("./GroupMessages/Message1.htm")
If blnUserHasAccess Then %>
<SCRIPT LANGUAGE="javascript">
var sFeatures="dialogHeight:425px; dialogWidth:400px; scroll:no;
status:no; help:no;";
//var sFeatures="dialogLeft:50px; dialogTop:50px; dialogHeight:425px;
dialogWidth:400px; scroll:no; status:no; help:no;";
window.showModalDialog("./groupmessages/Message1.htm", "", sFeatures);
</SCRIPT>
<% End If
blnUserHasAccess = objPC.HasAccess("./GroupMessages/Message2.htm")
If blnUserHasAccess Then %>
<SCRIPT LANGUAGE="javascript">
var sFeatures="dialogHeight:425px; dialogWidth:400px; scroll:no;
status:no; help:no;";
//var sFeatures="dialogLeft:150px; dialogTop:150px; dialogHeight:425px;
dialogWidth:400px; scroll:no; status:no; help:no;";
window.showModalDialog("./groupmessages/Message2.htm", "", sFeatures);
</SCRIPT>
<% End If %>
</head>


I would strongly suggest not to use this component, it was designed to be
used from asp and as such a STA COM component. ASP.NET runs by default as a
MTA host and using such components will require you to run in (a less
performant) aspnet compatibility mode.
If you need to know if a certain account has Read permissions for a file
(which is not needed when your site is configured correctly and you have an
authentication scheme in place) , simply open the file in read mode and
close it while impersonating.

Willy.
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John | last post: by
23 posts views Thread by da Vinci | last post: by
reply views Thread by Jeff | last post: by
1 post views Thread by Anoop | last post: by
3 posts views Thread by Milagro | last post: by
2 posts views Thread by beary | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.