从Sharepoint Web部件运行exe [英] Run exe from Sharepoint web part

查看:96
本文介绍了从Sharepoint Web部件运行exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在共享点Web部件中有一个按钮,单击该按钮可以启动计算器:

I have a button in a sharepoint web part that when clicked is supposed to launch the calculator:

protected void Button1_Click(object sender, EventArgs e)
{
        Process process = new Process();
        process.StartInfo = new ProcessStartInfo("Calc.exe");

        process.Start();
}

但是,当单击按钮时,什么也没有发生.有人可以告诉我如何从Sharepoint Web部件启动应用程序吗?

However, when the button is clicked, nothing happens. Can someone tell me how to launch applications from a sharepoint web part?

推荐答案

坦白地说,这是不可能的.您编写的代码在Web应用程序用户的安全上下文中的SharePoint服务器上执行.因此,如果什么都发生了,那么将为Web应用程序用户打开一个计算器,而肯定不会为您的用户打开.

Quite frankly this is not possible. The code you have written is executed on the SharePoint server in the security context of the web app user. So if anything happens at all, a calculator is opened for the web app user and certainly not for your user.

如果您要执行类似的操作,则必须使用客户端脚本技术,例如SilverlightJavaScript.但是,您必须处理权限问题,因为脚本通常无法访问本地硬盘以提高安全性.

If you want to do something like this you have to revert to client side scripting technologies, e.g. Silverlight or JavaScript. However, you have to deal with permission issues then as scripts normally can't access the local hard disk to improve security.

这篇关于从Sharepoint Web部件运行exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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