如何将.exe放在webiste中 [英] How to put .exe in webiste

查看:74
本文介绍了如何将.exe放在webiste中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想插入此软件用于预测 http://www.wxtide32.com/download.html [ ^ ](来自wxtide32的wxtide47.zip)

进入我网站上的一个文件夹,但我不知道

i认为这里 http://www.hobbypesca.com/nozioni_base/tavole_marea_e_fasi_lunari/porti_italiani/brindisi.asp [ ^ ]

和这里

http://www.biggame.it/maree/maree-reggiocalabria.htm [ ^ ]

他们这样做

你能不能帮助我

解决方案

试试这个代码



步骤1:

< asp:LinkBut​​ton ID =LinkBut​​ton2runat =serveronclick =LinkBut​​ton2_Click>下载PDF< / asp:LinkBut​​ton> 





步骤2:创建文件夹并将exe放置在该文件夹中.........



步骤3:

  protected   void  LinkBut​​ton2_Click( object  sender,EventArgs e)
{
// AdbeRdr910_en_US
string path = Server.MapPath( AdbeRdr910_en_US.exe); // 从服务器获取物理文件路径
string name = Path.GetFileName(path);
string ext = Path.GetExtension(path);
string type = ;

// 根据文件扩展名设置已知类型
< span class =code-keyword> if
(ext!= null
{
开关(ext.ToLower())
{
case 。htm
case 。html
type = 文本/ HTML;
break ;

case .txt
type = text / plain;
break ;

case 。GIF
type = image / GIF;
break ;

case .pdf
type = Application / pdf;
break ;
case 。exe
type = Application / exe;
break ;

case 。doc
case .rtf
type = Application / msword;
break ;


}
}

Response.AppendHeader( content-disposition attachment; filename = + name );

if (type!=
Response.ContentType = type;
Response.WriteFile(path);
Response.End(); // 为用户提供POP文件下载
}


I would like to insert this software for predicte tides http://www.wxtide32.com/download.html[^](wxtide47.zip from wxtide32)
into a folder on my website, but i dont' know
i think that here http://www.hobbypesca.com/nozioni_base/tavole_marea_e_fasi_lunari/porti_italiani/brindisi.asp[^]
and here
http://www.biggame.it/maree/maree-reggiocalabria.htm[^]
they do it
can you help me

解决方案

Try this code

Step 1:

<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Download PDF</asp:LinkButton>



Step 2: Create folder and place exe in that folder.........

Step 3:

protected void LinkButton2_Click(object sender, EventArgs e)
        {
            //AdbeRdr910_en_US
            string path = Server.MapPath("AdbeRdr910_en_US.exe"); //get physical file path from server
            string name = Path.GetFileName(path);
            string ext = Path.GetExtension(path);
            string type = "";

            // set known types based on file extension  
            if (ext != null)
            {
                switch (ext.ToLower())
                {
                    case ".htm":
                    case ".html":
                        type = "text/HTML";
                        break;

                    case ".txt":
                        type = "text/plain";
                        break;

                    case ".GIF":
                        type = "image/GIF";
                        break;

                    case ".pdf":
                        type = "Application/pdf";
                        break;
                    case ".exe":
                        type = "Application/exe";
                        break;

                    case ".doc":
                    case ".rtf":
                        type = "Application/msword";
                        break;

                    
                }
            }

            Response.AppendHeader("content-disposition", "attachment; filename=" + name);

            if (type != "")
                Response.ContentType = type;
            Response.WriteFile(path);
            Response.End(); //give POP to user for file downlaod
        }


这篇关于如何将.exe放在webiste中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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