Web 应用程序中的 RDP

发布于 2024-11-18 10:29:15 字数 1436 浏览 2 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

水溶 2024-11-25 10:29:15

您还可以查看 Myrtille,它类似于 鳄梨酱,但适用于 Windows。

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

You can also check Myrtille, which is similar to Guacamole, but for Windows.

PS: Myrtille is the open source incarnation of Steemind cited above. I just saw the comment as I write these lines. @lopsided: please apologize my high latency reply.

猫瑾少女 2024-11-25 10:29:15

在这里,我们创建了新的 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";

Here, We have created new rdp file with dynamic IP address to mentioned path and the same will be downloaded by using HttpResponseMessage

API Controller

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;
     }
   }
 }

Client Side Code:

window.location.href = "https:\\api.test.com\v1\azure\GetRDPFileDownload?ipAddress=10.10.10.10";
两人的回忆 2024-11-25 10:29:15

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

GoTo My PC: http://www.gotomypc.com/

LogMeIn:http://www.logmein.com/

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

I don't believe there is any way you can launch RDP from asp.net and relay it through the browser, there are other remoting solution that are web based, you can check out:

GoTo My PC: http://www.gotomypc.com/
and
LogMeIn: http://www.logmein.com/

If you don't need a GUI but need your ASP.NET to execute remote code on the other server you can probably use PowerShell's remoting features:
http://technet.microsoft.com/en-us/library/dd819505.aspx

〆凄凉。 2024-11-25 10:29:15

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

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

I do believe Window server already supports this you just need to install the RDP remote application watch this youtube to find out how to install http://www.youtube.com/watch?v=S6CIAGfcTU8&feature=related

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

禾厶谷欠 2024-11-25 10:29:15

将此代码传递到 HTML 文件,如果需要,您可以稍后将其分割,而不是分隔 HTML 和代码隐藏的 ASP.net aspx 文件。

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

查看最低要求到客户端机器。

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

Pass this code to an HTML File and if you want you can divide it later no an ASP.net aspx file separating the HTML and Code Behind.

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

Check out the minimal requirements to client machine.

Good Programming ! fellow "blue color workers" of the digital world ! :)

少女净妖师 2024-11-25 10:29:15

您可以创建一个链接,使用简单的控制器在 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>

You can create a link which will download an automatically generated .rdp file in ASP.Net MVC using a simple controller.

Create a controller:

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");
        }
    }
}

Create a link to call this in you view:

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

Or:

<a href="RemoteDesktop/Index?link=RemoteMachineName">RemoteMachineName</a>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文