我的代码没有进入页面加载。这是什么问题。我在pageload上使用了断点,但它没有进入页面加载。为什么会这样?帮我做这个
public partial class UploadVideo : System.Web.UI.Page
{
public string UploadVideoToFolder()
{
string vTitle = "";
string vDesc = "";
string FilePath = HttpContext.Current.Server.MapPath("~/ProductVideos/" + HttpContext.Current.Request.Form["title"]);
HttpFileCollection MyFileCollection = HttpContext.Current.Request.Files;
if (MyFileCollection.Count > 0)
{
// Save the File
try
{
MyFileCollection[0].SaveAs(FilePath);
return "1";
}
catch (Exception ex)
{
return "-1";
}
}
else
return "-1";
}
protected void Page_Load(object sender, EventArgs e)
{
string result = UploadVideoToFolder();
Response.Write(result);
}
}
}
答案 0 :(得分:1)
在这些状态下,问题很容易解决,例如您在Response.Redirect("name.aspx");
中写了错误的名称