[問題] 遠端安裝
小弟現在用IIS架設一個web
其中有一個頁面是可以選擇要下載哪些東西(server會列出來)
(要進入此頁面時,會跳出windows驗證,必需輸入可用在登錄server的windows帳密)
下載後是存放在server的某個資料夾底下(不在web底下)
下載完可以選擇要安裝哪個
現在卡在,當執行安裝檔時,總是會用ASPNET的身分去跑
這樣就變得沒有權限可以作安裝的動作了
以下是我的code
=========================
public static WindowsIdentity gwinId;
public static WindowsImpersonationContext cix;
protected void Page_Load(object sender, EventArgs e)
{
gwinId = (WindowsIdentity)HttpContext.Current.User.Identity;
try
{
cix = gwinId.Impersonate();
}
catch
{
//Impersonate() fail
}
}
void btn_Install_Click(object sender, EventArgs e)
{
string argIn = "/k cd \"" + fileFolderPath + "\"";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = argIn;
p.Start();
p.StandardInput.WriteLine("filename");
p.StandardInput.WriteLine("exit");
p.WaitForExit();
p.Close();
}
====================================================================
小弟我其實對C#不熟,應該說是根本沒接觸過
是這幾天某些因素,不得不用C#
請問有大大能替我解惑嗎?
為什麼在執行cmd.exe或安裝檔時,總是會用ASPNET去執行
而不是使用一開始頁面load時驗證過的帳戶呢?
謝謝!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.120.37.166
→
08/16 07:34, , 1F
08/16 07:34, 1F
※ 編輯: ljhgc 來自: 59.120.37.166 (08/16 13:22)
→
08/16 13:22, , 2F
08/16 13:22, 2F
→
08/16 13:22, , 3F
08/16 13:22, 3F
→
08/16 13:22, , 4F
08/16 13:22, 4F
→
08/16 13:22, , 5F
08/16 13:22, 5F
→
08/16 13:22, , 6F
08/16 13:22, 6F
→
08/16 13:22, , 7F
08/16 13:22, 7F
→
08/16 13:22, , 8F
08/16 13:22, 8F
→
08/16 13:23, , 9F
08/16 13:23, 9F