我打开新窗口弹出窗口时会出现一些问题,它可以读取我的路径并像扔掉我的“/”符号。所以它会看到这样的“C:UsersKHAIRADesktopheitechHibah Total v1.2 /安全/ PDF文件夹”如何使路径具有“/”
任何人都可以帮助我看起来/这样读“C:Users/KHAIRA/Desktop/heitech/Hibah Total v1.2 /安全/ PDF文件夹“。
我在GridView的打开按钮,将打开新窗口,查看这里的PDF文件从ViewDocument.aspx
string commandName = e.CommandName.ToString().Trim();
GridViewRow row = GridView1.Rows[Convert.ToInt32(e.CommandArgument)];
string folderName = ConfigurationManager.AppSettings["folderPDF"].ToString();
string path = Server.MapPath("~") + "/Secure/";
string fullPath = path + folderName;
string[] filePaths = Directory.GetFiles(fullPath, "*.pdf");
switch (commandName)
{
case "Open":
string script = "<script language=\"JavaScript\">\n";
script += "window.open ('OpenForm.aspx?path=" + row.Cells[0].Text;
script += "','CustomPopUp', config='height=500,width=1024, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, directories=no, status=no')\n";
script += "</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "onload", script);
break;
编码为OpenForm.aspx.cs编码:
catch(Exception ex)
{
try
{
string paths = Request.QueryString["path"].ToString();
bool fileExist = File.Exists(paths);
if (fileExist)
{
Response.ContentType = "Application/pdf";
Response.TransmitFile(paths);
}
else
{
Label1.Text = "File Not Exist";
}
}
但是,我意识到问题是从这里开始的
string paths = Request.QueryString["path"].ToString();
帮助你,你需要显示一些源代码... – Yahia 2012-03-28 06:21:23
你可以发布你使用的代码,你输入什么,以及它失败的地方。 – 2012-03-28 06:22:35