英文:
How to access local files using Remote Desktop (RemoteApp) and VB.NET
问题
抱歉,由于你的要求,我只会返回翻译好的部分,不提供其他内容。
"Is there a way that the user can see these local files?"
用户是否能够查看这些本地文件?
英文:
I have a development that was created to be able to read XML files so that the user could search these files locally, currently I was asked to bring this application to RemoteApp and it works very well, but the only "issue" is that when the user presses the button to be able to search for the files, the window runs on the server and does not allow me to see locally.
I have access to the source code and I understand that from the statement that I show as follows
documentoxml = New XmlDocument
Dim strPath As String = myOpenDialog.FileName
documentoxml.Load(strPath)
it goes and looks for where it is being executed and therefore shows the server. Obviously the route would be something like this for example
> C:\Users\Public\Documents
Is there a way that the user can see these local files? I am using Windows Server and Windows 10 as a client.
Thank you for your support.
答案1
得分: 3
以下是翻译好的内容:
遥控桌面意味着你的客户端计算机发送鼠标点击和屏幕更新。
换句话说,运行在远程服务器上的代码与使用TeamViewer或其他任何工具没有什么不同。远程计算机实际上与你坐在远程计算机的键盘和屏幕前没有太大区别。
所以,就像你现在在Stack Overflow上看这篇文章一样?这并不会突然允许远程计算机在你的本地计算机上操作或使用文件。
这里有两种方法。
首先,通常当你连接到远程计算机时,你还可以共享你的本地文件和文件夹。但这通常取决于远程桌面是如何启动的。
所以,这将是这个选项:
所以,除非用户已经共享了他们的驱动器,否则某些远程计算机不能突然开始使用你计算机上的文件。
第二个可能的选择?
这将要求你在客户端计算机上安装/编写一些代码。这些所谓的RDP "通道"将允许你的服务器端代码与客户端端代码进行通信,从而在本地计算机上执行本地操作。
例如,我们在Windows窗体中经常有一个按钮可以用来发送电子邮件,然后启动Outlook,填写正文文本,附加一个PDF,然后用户可以进一步编辑,然后发送电子邮件。
当通过远程桌面运行我们的应用程序时,当你点击相同的按钮时,我们启动Outlook,填写正文,并附加一个PDF,但我们启动了Outlook的客户端版本!(所以我们使用你的桌面上的Outlook副本,并从vb.net自动化该版本。这是RDP的一个令人惊叹的功能,但它需要在每台客户端计算机上安装一些软件才能正常工作。然而,一旦自定义的RDP通道安装在每台客户端计算机上,远程服务器端代码可以在客户端计算机上进行远程操作,即使他们没有共享他们的文件。
所以,如果用户共享他们的本地驱动器,你可以使用网络路径名访问客户端计算机,但这通常有一些限制。
英文:
Well, remote desktop means that your client side computer is sending mouse clicks, and screen updates back and forth.
In other words, your code running on that remote server is no different then using TeamViewer, or anything else. A remote computer is not really any different then you sitting down at the keyboard and screen of that remote computer.
So, just like while you looking at this post on SO? That does not now out of the blue THEN allow the remote computer to mess around and grab or use files on your local computer.
There are two approaches here.
First up, often when you connect to the remote computer, you can ALSO share your local files and folders. But, this will often depend on how remote desktop was launched.
So, that would be this option(s):
So, unless the user has shared their drives, then of course some remote computer can't just out of the blue start using files on your computer.
The 2nd possible choice?
This would requite you install/write some code that would be installed on the CLIENT side computer. These so called RDP "channels" would allow your server side code to talk to the client side code, and thus do local operaitons on the local computer.
For example, we often in a windows form have a button to click on for a email, we then launch outlook, fill in the body text, attached a pdf, and then the usere can futher edit, and then send the email.
Well, when running our applicaion via remote desktop, when you click on that same button, we launch outlook, fill out the body, and attach a pdf, but we launching the CLIENT SIDE version of outlook!! (so we use YOUR copy of outlook on YOUR desktop, and automate that version from vb.net. This is a amazing feature of RDP, but it does require that some software be installed on each client computer for this to work. however, once the custom RDP channel is installed on each client computer, then the remote server side code can do remote operations on the client side computer - EVEN if they not shared their files.
So, if users do/have/will shared their local drive, then you can use network path names to the client side computer, but this tends to be limited.
答案2
得分: 0
如果远程会话使用用户的正常凭据,您可以使用
Dim strPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
来访问用户漫游配置文件中的“文档”文件夹(以及其他虚拟文件夹)。
这并不完全符合您的要求,但这可能是您所需要的。
英文:
If the remote session is using the user's normal credentials, you can use
Dim strPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
to get access to the Documents folder (and other virtual folders) in the user's roaming profile.
This isn't exactly what you've asked for, but it might be what you need.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论