我无法在asp.net中看到自动生成的代码,因为我们可以在带有designer.cs文件的win表单中看到此代码。
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}发布于 2013-09-10 04:08:05
如果您使用的是ASP.NET“网站”,那么就没有自动生成的代码。无需使用设计器文件即可分析和编译标记。
在"Web应用程序“中,您可以将自动生成的设计器文件与常规的代码隐藏文件一起使用。它位于一个分部类中,所以实际上每个页面有三个物理文件(.aspx、aspx.cs、.aspx.designer.cs)。
这两个概念彼此非常不同,所以如果你不清楚其中的区别,我建议你在asp.net website vs web application上搜索一下,看看其他一些更重要的区别。
尽管WebSite确实有优势,但大多数人倾向于发现Web Application是两者中的首选--它是一个更“真实”的.NET项目。此外,在WebForms之上继续发展的Web只在“ASP.NET应用程序”中可用,而不是"WebSite“。
https://stackoverflow.com/questions/18706107
复制相似问题