簡體   English   中英

如何將當前(Windows)用戶的憑據分配給ftpWebRequest

[英]How to assign credentials of current (Windows) user to ftpWebRequest

如何將當前(Windows)憑據分配給ftpWebRequest。 我不想明確指定憑據,而是使用用戶(登錄)當前的Windows憑據。

在您的web.config中,您需要以下內容:

<authentication mode="Windows"/>

然后在IIS中,將您的應用程序池配置為以集成模式運行。

然后,在調用ftpwebrequest的代碼中,您可以使用安全性原理-例如:

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM