ASP.NET Function to Check user has read access to a file

Discussion in 'ASP .Net' started by Girish bharadwaj, Sep 23, 2004.

  1. I would think FileIOPermission might help you. See help for that class and
    related Security demands and asserts to see if they help you out.

    --
    Girish Bharadwaj
    http://msmvps.com/gbvb
    "Raed Sawalha" <> wrote in message
    news:...
    Hi all,

    I need a function which will return read access for the current user as true
    or false when a file path is passed to it (either local or UNC share).

    My web-config file is using windows authentication and impersonate = true.
    The idea is to check that the user has access to each file before displaying
    it in a list.

    Thanks for any help!
     
    Girish bharadwaj, Sep 23, 2004
    #1
    1. Advertising

  2. Girish bharadwaj

    Raed Sawalha Guest

    Hi all,

    I need a function which will return read access for the current user as true or false when a file path is passed to it (either local or UNC share).

    My web-config file is using windows authentication and impersonate = true. The idea is to check that the user has access to each file before displaying it in a list.

    Thanks for any help!
     
    Raed Sawalha, Sep 23, 2004
    #2
    1. Advertising

  3. Girish bharadwaj

    Raed Sawalha Guest

    ya that worked fine i did like this and worked perfectly

    FileIOPermission f = new
    FileIOPermission(FileIOPermissionAccess.AllAccess,MyFile);


    try

    {

    f.Demand();

    return true;



    }

    catch

    {

    Exception ex = new Exception();

    string s = ex.Message ;

    return false

    }

    Thanks
    "Girish bharadwaj" <> wrote in message
    news:...
    > I would think FileIOPermission might help you. See help for that class and
    > related Security demands and asserts to see if they help you out.
    >
    > --
    > Girish Bharadwaj
    > http://msmvps.com/gbvb
    > "Raed Sawalha" <> wrote in message
    > news:...
    > Hi all,
    >
    > I need a function which will return read access for the current user as

    true
    > or false when a file path is passed to it (either local or UNC share).
    >
    > My web-config file is using windows authentication and impersonate = true.
    > The idea is to check that the user has access to each file before

    displaying
    > it in a list.
    >
    > Thanks for any help!
    >
    >
     
    Raed Sawalha, Sep 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Davie

    User Has Access To File/Folder

    Davie, Oct 21, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    379
    Davie
    Oct 21, 2004
  2. Doug
    Replies:
    3
    Views:
    4,410
    Bruce Barker
    Nov 4, 2005
  3. Markus Kemp
    Replies:
    8
    Views:
    460
    Peter Hansen
    Nov 18, 2004
  4. Alex Dowad
    Replies:
    4
    Views:
    315
    Michel Demazure
    May 1, 2010
  5. Replies:
    3
    Views:
    116
    Thomas 'PointedEars' Lahn
    May 17, 2005
Loading...

Share This Page