Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 20th, 2004, 02:14 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Tom Perro
Default Folder listing and permissions

I have an aspx page that is displaying the contents of a directory on my web server. Each folder has different permissions based on user log ons. My problem is this. . .
I do not want to display folders in which users do not have permission to. Is there a way to do this?

Here is the code . . .
C#

public void Page_Load(object s, System.EventArgs ea) {
    try {
        string strDir = Request.QueryString["d"];
        string strParent = strDir.Substring(0,strDir.LastIndexOf("\\"));
        strParent += strParent.EndsWith(":") ? "\\" : "";
        upLink.NavigateUrl = "browse.aspx?d="+strParent;
        txtCurrentDir.Text = "Address: <b>"+strDir + "</b>";
        DirectoryInfo DirInfo = new DirectoryInfo(strDir);
        DirectoryInfo[] subDirs = DirInfo.GetDirectories();



        FileInfo[] Files = DirInfo.GetFiles();
        txtListing.Text = "<table>";
        for (int i=0; i<=subDirs.Length-1; i++) {

            txtListing.Text +="Check auth here";

            txtListing.Text += "<tr><td><img src='images/folder.gif'><a href='browse.aspx?d="+subDirs[i].FullName+"' class='entry'>"+subDirs[i].Name+"</a></td><td valign='bottom'>"+subDirs[i].LastWriteTime+"</td></tr>";
        }
        for (int i=0; i<=Files.Length-1; i++) {
            txtListing.Text += "<tr><td><img src='images/file.gif'>"+Files[i].Name+"</td><td valign='bottom'>"+Files[i].LastWriteTime+"</td></tr>";
        }
        txtListing.Text += "</table>";

    }

    catch (UnauthorizedAccessException ex){

    }


    catch (Exception e){

        txtListing.Text = "Error retrieving directory info: "+e;
    }
}

Reply With Quote
  #2 (permalink)  
Old February 23rd, 2004, 10:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen N, , Denmark.
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

Wrong forum..
Use this instead: http://p2p.wrox.com/forum.asp?FORUM_ID=56

Regards - Jon
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Folder Permissions lewdogg Classic ASP Components 0 June 28th, 2005 07:23 PM
Listing Folder Content jmss66 Classic ASP Basics 7 August 9th, 2004 11:40 AM
How to set permissions on a shared folder adman Pro VB 6 1 February 19th, 2004 11:07 AM
Set permissions on a shared folder adman Beginning VB 6 2 February 12th, 2004 03:06 AM



All times are GMT -4. The time now is 04:11 AM.


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