使用 Process.StartInfo.UserName

发布于 2024-10-14 18:29:20 字数 373 浏览 3 评论 0原文

我的网站有一个可打开游戏的链接按钮:

Process game= new Process();
    game.StartInfo.FileName = HttpContext.Current.Request.MapPath("~/iFarkle.exe");
    game.StartInfo.UserName = Session["Username"].ToString();
    game.StartInfo.UseShellExecute = false;
    game.Start();

如何使用 StartInfo.UserName? (现在不起作用,我输入了错误的数据,它仍然存在)(无需 StartInfo.UserName 即可工作

I have a website that has a linkbutton that opens a game :

Process game= new Process();
    game.StartInfo.FileName = HttpContext.Current.Request.MapPath("~/iFarkle.exe");
    game.StartInfo.UserName = Session["Username"].ToString();
    game.StartInfo.UseShellExecute = false;
    game.Start();

How do I use the StartInfo.UserName?
(it doesn't work right now, it stays I entered bad data)(works without the StartInfo.UserName

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

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

发布评论

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

评论(1

贱贱哒 2024-10-21 18:29:20

如果您希望 exe 在用户计算机上运行,​​您可以:

提供 exe 文件的直接链接(并确保您的服务器配置为提供 .exe 文件),或者,

将文件内容流回响应(确保设置响应 ContentType 到合适的类型(我认为 application/x-msdownload 可以))。

例如,如果我打算在允许下载之前执行一些额外的检查,我只会执行第二个操作。当然,一旦用户下载了 exe,他们就可以随意使用它。

另请注意,只有当 exe 没有它所依赖的任何其他 DLL 时,这才有效(可以安全地假设已经可以在客户端计算机上访问的 DLL 除外)。

If you want the exe to run on the users computer, you can either:

Provide a direct link to the exe file (and make sure your server is configured to serve .exe files), or,

Stream the contents of the file back in the response (having made sure to set the Response ContentType to a suitable type (I think application/x-msdownload would work)).

I'd only do the second if I was going to, for example, perform some additional checks before allowing the download. Of course, as soon as the user has downloaded the exe, they'll be free to do with it whatever they please.

Also note that this will only work if the exe doesn't have any other DLLs it relies on (except DLLs which are safe to assume will already be accessible on the client machine).

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