Implications of adding enctype="multipart/form-data" in a master page?
We have one master page for an entire asp.net 2.0 site, which contains the form tag.
Ar开发者_Python百科e there any implications to adding enctype to the form tag? One page needs to be able to upload a file, and I believe this is required in order for that to function properly. Do we need to re-test the entire site after making this change?
Prior to this, the form tag was simply:
<form id="form1" runat="server">
You can use code to programmatically set the attributes of form tag. And you can put the code in a proper page event such as "Init" event.
e.g.
public partial class test_TestContentPage : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
this.Form.Enctype = "multipart/form-data";
}
}
We did that a while back and never gave it another thought.
Our main app has literally hundreds of pages all with various input controls (text, multiline, drop down lists, checkboxes, etc) and we've never seen an issue.
精彩评论