473,386 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 3301

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John | last post by:
Sorry, but how does one move up a directory ? I'm in a directory from which I called a script. Part of the script functionality is checking the permissions of the directory I am in. I may need...
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
3
by: Jim Hunter | last post by:
From what I've read, the only indication fprintf gives of an error is a negative return value. I have a series of writes to a file using fprintf, and, while I need to know if a failure has...
0
by: Jeff | last post by:
I am trying to write some C# code that will allow me to determine if the current user running my application has "write" permissions to a particular folder. However, I can't seem to get it to...
1
by: Anoop | last post by:
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop
0
by: rdemyan | last post by:
Is there a way to check the validity of front-end table links on a backend file where all permissions to data have been revoked. To get at the data, the front end uses RWOP queries. What I'm...
3
by: Milagro | last post by:
Hello Everyone, I'm trying to debug someone elses php code. I'm actually a Perl programmer, with OO experience, but not in php. The code is supposed to upload a photo from a form and save it...
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
2
by: beary | last post by:
Hello everyone, I posted this in unix/linux but it received no replies, so I assume it was the wrong forum. I'm trying here. I'm in way over my head with file permissions. The directory and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.