我如何发动对网页加载.exe文件保存或运行?加载、网页、文件、exe

2023-09-03 03:08:14 作者:菇娘爾夥愛妳#

我有这样的潜在客户的形式和他们给我们自己的信息后,我想在窗体的感谢页面弹出一个窗口,用户可以保存文件或打开它。

I have this lead generation form and after they give us their information, I would like the form's thank you page to popup a window where the user can save the file or open it.

该网页将可以从微软服务器提供让.NET C#或JavaScript的选项。

This web page will be served from a Microsoft server so .net C# or javascript are options.

THX

推荐答案

祝你好运得到任何浏览器中打开.exe文件...警告将罗宾逊...警告...

Good luck getting any browser to open an .exe file... Warning Will Robinson... Warning...

不管怎么说,这里有一个片段......

Anyways, here's a snippet....

                Response.Clear();
                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName);

                while (dataToRead > 0)
                {
                    if (Response.IsClientConnected)
                    {
                        fileLength = iStream.Read(buffer, 0, buffer.Length);
                        Response.OutputStream.Write(buffer, 0, fileLength);
                        Response.Flush();
                        dataToRead = dataToRead - fileLength;
                    }
                    else
                    {
                        dataToRead = -1;//prevent infinite loop if user disconnects
                    }
                }

编辑:好吧,我想你可以创建谢谢配合就可以了隐藏式按键页,注入一些JavaScript点击在负载按钮,然后将执行code将文件转储到响应流

Ok, i suppose you could create the thank you page with a hidden button on it, inject some javascript to click that button upon load, which would then execute the code to dump the file into the response stream.