Suppress login dialog when impersonation on?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Suppress login dialog when impersonation on?

    Does anyone know how I can suppress the "Enter Network
    Password" dialog when attempting to enumerate directories
    and/or files in ASP.NET? I want my code to automatically
    generate an exception if the current user is not allowed
    to access a share folder or file instead of prompting the
    user to enter a username/pwd. I'm using:

    dirs = Directory.GetDirectories(sPath)

    Or, is there an easier way to determine if the current
    user has access to a share folder/file?

    Thanks, Gary.

    Gary H. Guest

  2. Similar Questions and Discussions

    1. Compare PDF: How to simulate ENTER Keyprogrammatically to suppress the dialog box.
      Hi, We are using Acrobat 8.0. Using Visual Basic, we are opening two PDF files in Acrobat 8.0 professional.We are comparing those two documents...
    2. IIS sends login dialog for already authenticated users.
      Hi, I am using ASP.NET windows authentication in one of the applications. My application is deployed on one of the 2003 servers. This server is...
    3. Fixed Impersonation vs Current login user
      I have a ASp.NET application which performs a http request to another web site on the same server but different virtual directory. when i set...
    4. ASP remote authentication / surpress login dialog
      Hello everybody, I need to setup a mechanism (preferred in ASP .net) to open an URL on a different user level protected virtual server (or even...
    5. How to Suppress the File Download Dialog Box
      I have made a GPO in Active Directory that runs a exe file at logon. Works fine but i get a Download Dialog Box first......:-( How do i Suppress...
  3. #2

    Default RE: Suppress login dialog when impersonation on?

    Hi Gary ,

    You can use the try-catch block to catch the permission denied exceptions.
    When you attempt to access files/folders that you are granted access to,
    you will get SecurityException exceptions. You can catch the exceptions and
    return a message to the user that he/her has no permission to the resource.

    For example:

    private void Button1_Click(object sender, System.EventArgs e)
    {
    try
    {
    string[] dirs=Directory.GetDirectories("H:\\WUTemp");
    foreach(string dir in dirs)
    DropDownList1.Items.Add(dir);
    }
    catch(Exception e1)
    {
    //Return a message to users
    Label1.Text =e1.Message;
    }
    }

    Regards,

    Felix Wu
    =======
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >Content-Class: urn:content-classes:message
    >From: "Gary H." <ghardley@chaslevy.com>
    >Sender: "Gary H." <ghardley@chaslevy.com>
    >Subject: Suppress login dialog when impersonation on?
    >Date: Mon, 14 Jul 2003 09:17:15 -0700
    >Lines: 14
    >Message-ID: <01af01c34a23$63b89da0$a101280a@phx.gbl>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Thread-Index: AcNKI2O4spXv0Q1QT+6akK2rFOW1zQ==
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    >Path: cpmsftngxa06.phx.gbl
    >Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.security: 5882
    >NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    >
    >Does anyone know how I can suppress the "Enter Network
    >Password" dialog when attempting to enumerate directories
    >and/or files in ASP.NET? I want my code to automatically
    >generate an exception if the current user is not allowed
    >to access a share folder or file instead of prompting the
    >user to enter a username/pwd. I'm using:
    >
    >dirs = Directory.GetDirectories(sPath)
    >
    >Or, is there an easier way to determine if the current
    >user has access to a share folder/file?
    >
    >Thanks, Gary.
    >
    >
    Felix Wu [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139