【问题标题】:RDP in web application [closed]Web 应用程序中的 RDP [关闭]
【发布时间】:2011-07-03 20:19:51
【问题描述】:

ASP.NET:有没有办法在我的 Web 应用程序中使用 rdp?我需要创建 asp.net 应用程序并通过我的网页从我的电脑打开远程桌面到另一个桌面

【问题讨论】:

    标签: asp.net remote-desktop remote-access


    【解决方案1】:

    您也可以查看Myrtille,它类似于Guacamole,但适用于Windows。

    PS:Myrtille 是上面提到的 Steemid 的开源化身。我刚刚在写这些行时看到了评论。 @loplateral:请为我的高延迟回复道歉。

    【讨论】:

      【解决方案2】:

      在这里,我们已经创建了新的 rdp 文件,其中包含动态 IP 地址到上述路径,并且将使用 HttpResponseMessage 下载相同的文件

      API 控制器

      using System.Text;
      using System.Web.Mvc;
      
      namespace SafeIntranet.Controllers
      {
        public class RemoteDesktopController : Controller
        {
      
           public HttpResponseMessage GetRDPFileDownload(string ipAddress)
           {
               string filePath = @"C:\Test\AzureVMFile.rdp";
      
               if (File.Exists(filePath))
               {
                   File.Delete(filePath);
               }
               using (FileStream fs = File.Create(filePath))
               {
                   Byte[] title = new UTF8Encoding(true).GetBytes("full address:s:" + ipAddress + ":3389 \nprompt for credentials:i:1 \nadministrative session:i:1");
                   fs.Write(title, 0, title.Length);
               }
               MemoryStream dataStream = null;
               var fileBytes = File.ReadAllBytes(filePath);
               dataStream = new MemoryStream(fileBytes);
      
               HttpResponseMessage HttpResponseMessage = Request.CreateResponse(HttpStatusCode.OK);
               HttpResponseMessage.Content = new StreamContent(dataStream);
               HttpResponseMessage.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
               HttpResponseMessage.Content.Headers.ContentDisposition.FileName = "AzureVM.rdp";
               HttpResponseMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
               return HttpResponseMessage;
           }
         }
       }
      

      客户端代码:

      window.location.href = "https:\\api.test.com\v1\azure\GetRDPFileDownload?ipAddress=10.10.10.10";
      

      【讨论】:

        【解决方案3】:

        我不相信有任何方法可以从 asp.net 启动 RDP 并通过浏览器进行中继,还有其他基于 Web 的远程解决方案,您可以查看:

        转到我的电脑:http://www.gotomypc.com/

        登录:http://www.logmein.com/

        如果您不需要 GUI,但需要 ASP.NET 在另一台服务器上执行远程代码,您可能可以使用 PowerShell 的远程处理功能: http://technet.microsoft.com/en-us/library/dd819505.aspx

        【讨论】:

          【解决方案4】:

          我相信 Window 服务器已经支持这一点,您只需安装 RDP 远程应用程序观看此 youtube 以了解如何安装 http://www.youtube.com/watch?v=S6CIAGfcTU8&feature=related

          信息http://www.youtube.com/watch?v=7KKtTw5RTCc

          【讨论】:

            【解决方案5】:

            将此代码传递给一个 HTML 文件,如果您愿意,您可以稍后将其分割,而不需要一个 ASP.net aspx 文件来分隔 HTML 和后面的代码。

            http://msdn.microsoft.com/en-us/library/windows/desktop/aa380809%28v=vs.85%29.aspx

            查看对客户端计算机的最低要求。

            好的编程!数字世界的“蓝色工作者”! :)

            【讨论】:

              【解决方案6】:

              您可以创建一个链接,该链接将使用简单的控制器在 ASP.Net MVC 中下载自动生成的 .rdp 文件。

              创建一个控制器:

              using System.Text;
              using System.Web.Mvc;
              
              namespace SafeIntranet.Controllers
              {
                  public class RemoteDesktopController : Controller
                  {
                      public ActionResult Index(string link)
                      {
                          Response.AddHeader("content-disposition", "attachment; filename= " + link + ".rdp");
              
                          return new FileContentResult(
                              Encoding.UTF8.GetBytes($"full address:s: {link}"), 
                              "application/rdp");
                      }
                  }
              }
              

              创建一个链接以在您的视图中调用它:

              @Html.ActionLink("RemoteMachineName", "Index", "RemoteDesktop", new { link = "RemoteMachineName" }, null)
              

              或者:

              <a href="RemoteDesktop/Index?link=RemoteMachineName">RemoteMachineName</a>
              

              【讨论】:

                猜你喜欢
                • 2016-02-17
                • 2020-09-03
                • 2012-04-03
                • 1970-01-01
                • 2016-06-19
                • 1970-01-01
                • 2010-10-05
                • 2010-10-08
                • 1970-01-01
                相关资源
                最近更新 更多