Tôi gặp sự cố với quá trình bắt đầu trong ngữ cảnh mạo danh trong ASP.NET 2.0.Quá trình bắt đầu và mạo danh
Tôi đang bắt đầu Quy trình mới trong mã dịch vụ web của mình. IIS 5.1, .NET 2,0
[WebMethod]
public string HelloWorld()
{
string path = @"C:\KB\GetWindowUser.exe";
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = Path.GetDirectoryName(path);
startInfo.FileName = path;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.ErrorDialog = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process docCreateProcess = Process.Start(startInfo);
string errors = docCreateProcess.StandardError.ReadToEnd();
string output = docCreateProcess.StandardOutput.ReadToEnd();
}
Các "C: \ KB \ GetWindowUser.exe" là giao diện điều khiển ứng dụng có chứa đoạn mã sau:
static void Main(string[] args)
{
Console.WriteLine("Windows: " + WindowsIdentity.GetCurrent().Name);
}
Khi tôi gọi dịch vụ web mà không cần mạo danh, tất cả mọi thứ hoạt động tốt.
Khi tôi bật mạo danh, lỗi sau được viết bằng "lỗi" biến trong mã dịch vụ web:
Unhandled Exception: System.Security.SecurityException:. Truy cập bị từ chối \ r \ n \ r \ n tại System.Security.Principal.WindowsIdentity.GetCurrentInternal (TokenAccessLevels wantAccess, Boolean threadOnly) \ r \ n tại System.Security.Principal.WindowsIdentity.GetCurrent() \ r \ n tại ObfuscatedMdc.Program.Main (String [] args) \ r \ nMục của hội đồng thất bại là: \ r \ nMyComputer
Người dùng bị mạo danh là quản trị viên cục bộ và có quyền truy cập vào C: \ KB \ GetWindowUser.exe thực thi. nhắn
Khi tôi xác định người sử dụng cửa sổ một cách rõ ràng về tính chất ProcesStartInfo Domain, tài khoản và mật khẩu, tôi đã sau: http://img201.imageshack.us/img201/5870/pstartah8.jpg
Có thể bắt đầu quá trình với các thông tin khác so với ASPNET từ asp.net (IIS 5.1)?
bất kỳ giải pháp cuối cùng với đầy đủ mẫu mã nguồn làm việc về nó? – Kiquenet