我用一些菜单项定义了一个母版页。我使用文件上传控件,我只是在显示文件内容以在另一个内容页面上打开它时遇到问题:newModel.aspx 页面。它的工作将但我无法显示内容,我收到一个错误:找不到文件'C:\ Program Files(x86)\ Common Files \ Microsoft Shared \ DevServer \ 10.0 \ C%3a%5cUsers%5chhassan%5cDocuments%5cVisual +Studio+2010%5cWebSites%5cKBD-2013%5cModel%5cTest.edd'。
C# MasterPage-代码:
protected void Open_btn_click(object sender, EventArgs e)
{
bool fileOK = false;
string SampleDocuments = Server.MapPath(string.Empty);
if (FileUploadCtrl.HasFile)
{
string fileExtension = System.IO.Path.GetExtension(FileUploadCtrl.FileName).ToLower();
string allowedExtension = ".edd";
if (fileExtension == allowedExtension)
{
fileOK = true;
}
}
if (fileOK == true)
{
string fileName = SampleDocuments + "\\Model" + "\\" + FileUploadCtrl.FileName;
Response.Redirect("~/Model/newModel.aspx?fileName=" + fileName);
}
newModel 页面代码:
protected void Page_Load(object sender, EventArgs e)
{
String fileName = HttpUtility.UrlEncode(Request.QueryString["fileName"]);
this.DiagramWebControl1.LoadBinaryDocument(fileName);
}