打开和下载word文件正常,播放mp3出错,请问是何原因?xyzy_bf.aspx.csusing System;
using System.Collections;
using System.ComponentModel;
using System.Data;
//using System.Data.SqlClient;
//using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace xbgwmis
{
/// <summary>
/// xyzy_down 的摘要说明。
/// </summary>
public class xyzy_bf: System.Web.UI.Page
{
public string conn_str;
public string bt;
public string fbsj;
public string path;
private void Page_Load(object sender, System.EventArgs e)
{
conn_str=System.Configuration.ConfigurationSettings.AppSettings["conn_str"];
if(!IsPostBack)
{
bt=Request.QueryString["bt"].ToString().Trim();
fbsj=Request.QueryString["fbsj"].ToString().Trim();
Session["bt"] = bt;
Session["fbsj"] = fbsj; SqlConnection conn=new SqlConnection(conn_str);
string strsql="select * from xyyh_xyzy where bt='"+bt+"' and fbsj='"+fbsj+"'";
SqlDataAdapter da=new SqlDataAdapter(strsql,conn);
DataSet ds=new DataSet();
da.Fill(ds,"xyyh_xyzy");
DataTable dt=ds.Tables["xyyh_xyzy"];
conn.Close();
if (dt.Rows.Count>0)
{
DataRow dr=dt.Rows[0];
if(dr["wjmc"].ToString()!="")
{
string strfilename=dr["wjmc"].ToString();
// string aa=Server.UrlDecode(strfilename);
// System.Web.HttpUtility.UrlEncode(strfilename);
// string bb=System.Web.HttpUtility.UrlDecode(aa,System.Text.Encoding.GetEncoding("Gb2312"));
// path=Request.ApplicationPath+"/file/"+bb;
strfilename=Request.ApplicationPath+"/file/"+strfilename;
Response.Redirect(strfilename);
}
else
{
Response.Write("<script>alert('没有指定文件!');window.close();</"+"script>");
}
}
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
using System.Collections;
using System.ComponentModel;
using System.Data;
//using System.Data.SqlClient;
//using System.Data.OleDb;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace xbgwmis
{
/// <summary>
/// xyzy_down 的摘要说明。
/// </summary>
public class xyzy_bf: System.Web.UI.Page
{
public string conn_str;
public string bt;
public string fbsj;
public string path;
private void Page_Load(object sender, System.EventArgs e)
{
conn_str=System.Configuration.ConfigurationSettings.AppSettings["conn_str"];
if(!IsPostBack)
{
bt=Request.QueryString["bt"].ToString().Trim();
fbsj=Request.QueryString["fbsj"].ToString().Trim();
Session["bt"] = bt;
Session["fbsj"] = fbsj; SqlConnection conn=new SqlConnection(conn_str);
string strsql="select * from xyyh_xyzy where bt='"+bt+"' and fbsj='"+fbsj+"'";
SqlDataAdapter da=new SqlDataAdapter(strsql,conn);
DataSet ds=new DataSet();
da.Fill(ds,"xyyh_xyzy");
DataTable dt=ds.Tables["xyyh_xyzy"];
conn.Close();
if (dt.Rows.Count>0)
{
DataRow dr=dt.Rows[0];
if(dr["wjmc"].ToString()!="")
{
string strfilename=dr["wjmc"].ToString();
// string aa=Server.UrlDecode(strfilename);
// System.Web.HttpUtility.UrlEncode(strfilename);
// string bb=System.Web.HttpUtility.UrlDecode(aa,System.Text.Encoding.GetEncoding("Gb2312"));
// path=Request.ApplicationPath+"/file/"+bb;
strfilename=Request.ApplicationPath+"/file/"+strfilename;
Response.Redirect(strfilename);
}
else
{
Response.Write("<script>alert('没有指定文件!');window.close();</"+"script>");
}
}
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货