如何访问C:\\ Program Files文件\\ ...客户端PC的路径Asp.NET C#? [英] How to access C:\Program Files\... path of client PC in Asp.NET C#?

查看:154
本文介绍了如何访问C:\\ Program Files文件\\ ...客户端PC的路径Asp.NET C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Asp.NET Web应用程序。我可以打电话和我的应用程序上的本地运行时,运行Teamviewer。

I have an Asp.NET web application. I can call and run Teamviewer in my application when running on local.

我有调用类和运行TeamViewer。

I have a class for call and run TeamViewer.

class CallTeamViewer {      
    public static string TeamViewerPath = "";
    public static void FindTeamViewerPath ()  {
        if (File.Exists(@"C:\Program Files\TeamViewer\Version7\teamviewer.exe")) {  
            TeamViewerPath = @"C:\Program Files\TeamViewer\Version7\teamviewer.exe";
        }
        if (File.Exists(@"C:\PROGRAM FILES (X86)\TeamViewer\Version8\teamviewer.exe")){ 
            TeamViewerPath = @"C:\PROGRAM FILES (X86)\TeamViewer\Version8\teamviewer.exe";
        }
    }
    public static void ConnectAndRunTeamViewer(string TamViewerId, string TeamViewerPass) {
        CallTeamViewer.FindTeamViewerPath();
        if(TeamViewerPath.Length > 0) { 
            string parameter;
            parameter = " -i " + TamViewerId+ " --Password " + TeamViewerPass+ "";
            System.Diagnostics.Process.Start(TeamViewerPath,parameter);
        }
    }
}

我有两个文本框和aspx页面1按钮

I have 2 textboxes and 1 button on aspx page

Connect.aspx.cs

Connect.aspx.cs

protected void btnConnect_Click(object sender, EventArgs e) {
    CallTeamViewer.ConnectAndRunTeamViewer(txtTeamviewerID.Text,txtTeamviewerPass.Text); 
}

本类适用于当地。它可以在我的电脑Teamviewer的路径。

This class works on local. It can find the path of Teamviewer in my computer.

我的问题:我怎样才能改变我的类来找到客户端用户的Teamviewer的路径

My question: How can I change my class to find path of Teamviewer of client user?

推荐答案

有似乎是网络是如何工作的误解:)你需要运行在客户端的东西 - 而不是在服务器端。 ASP.NET只执行服务器端(和回传只是HTML标记是由浏览器PTED间$ P $)。对于这样的工作你需要一个胖客户端 - 见@Damien_The_Unbeliever有关安全评论 - LOL顺便说一句。既然你在.NET世界是了,我建议使用ClickOnce(.NET技术,让您只需点击安装从网页URL应用程序 - 只要你的客户已经安装了.NET框架),并让小的应用程序,将做胖客户端的工作适合你。

There seems to be misunderstanding of how web works :) You need to run something on client side - not on server side. ASP.NET executes just on server side (and passes back just html markup that is interpreted by browser). For this kind of work you need a thick client - see @Damien_The_Unbeliever comment regarding security - LOL btw. Since you're already in .NET world, I recommend using ClickOnce (.NET technology that allows you to install applications from web url with just one click - provided your clients have .NET framework installed) and make small app that will do the "thick client" job for you.

这篇关于如何访问C:\\ Program Files文件\\ ...客户端PC的路径Asp.NET C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆