AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Prism Verzeichniszugriff mit Userrechten in ASP.NET
Thema durchsuchen
Ansicht
Themen-Optionen

Verzeichniszugriff mit Userrechten in ASP.NET

Ein Thema von sakura · begonnen am 18. Mai 2006 · letzter Beitrag vom 26. Mai 2006
Antwort Antwort
Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#1

Verzeichniszugriff mit Userrechten in ASP.NET

  Alt 18. Mai 2006, 11:50
Hallo DPler,

ich versuche jetzt seit geraumer Zeit folgendes Szenario umzusetzen (leider ohne Erfolg):

Eine ASP.NET Anwendung soll im Intranet mit integrierter Windows Authentifizierung laufen, so dass der Nutzer sich von seinem Rechner aus nicht explizit anmelden muss, sondern seine Identität automatisch übernommen werden kann. (kein Problem )
Diese ASP.NET Anwendung läuft auf einem Web-Server, nennen wir den Web.

Auf einem weiteren Server (Network Attached Storage mit NTFS-Rechten), nennen wir den mal NAS liegen jetzt verschiedene Projektverzeichnisse. Der Zugriff auf diese Verzeichnisse ist ganz normal über die Windowsrechte (Benutzer und/oder Gruppen) geregelt.

Für eine Auswertung möchte ich jetzt, dass der User, der über den Intrantserver Web kommt, ich auf die Verzeichnisse auf NAS zugreifen kann, auf welche dieser User auch Rechte hat. Am nahe liegendsten wäre hier imo die Impersonation. Entweder über die weg.config
Code:
<configuration>
  <system.web>
    <identity impersonate="true" />
  </system.web>
</configuration>
oder aber über Code:
Delphi-Quellcode:
var
  impersonationContext: System.Security.Principal.WindowsImpersonationContext;
begin
  impersonationContext := WindowsIdentity.GetCurrent.Impersonate;
  try
    ///
  finally
    impersonationContext.Undo();
  end;
end;
bzw.
Delphi-Quellcode:
var
  impersonationContext: System.Security.Principal.WindowsImpersonationContext;
begin
  impersonationContext := System.Security.Principal.WindowsIdentity(User.Identity).Impersonate();
  try
    ///
  finally
    impersonationContext.Undo();
  end;
end;
Leider funktioniert keiner dieser Ansätze. Es wird immer die folgende Fehlermeldung ausgeworfen:
Zitat:
Server Error in '/AnalyzeDriveSize' Application.
--------------------------------------------------------------------------------

Access to the path "\\...\...\..." is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path "\\...\...\..." is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

[code]An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. [code]

Stack Trace:....
Wer hat einen Weg für mich?

......
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat
Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: Verzeichniszugriff mit Userrechten in ASP.NET

  Alt 26. Mai 2006, 10:07
*schieb* und noch einmal nachfrag

......
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz