Asp. NET Learning Notes 003--website and webapplication difference

Source: Internet
Author: User
Previously written courses are not attached to the source code, I am sorry!
In the course of the source code can add QQ request: 1606841559
Technical Exchange QQ1 Group: 251572072
Technical Exchange QQ2 Group: 170933152
You can also download it yourself:
Asp. NET Learning Notes 003 The difference between a website and a webapication. zip
Http://credream.7958.com/down_20144362.html


1. NEW: WebApplication1
Drag a button
Code in Default.aspx:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;


Namespace WebApplication1
{
public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{


}


protected void Button1_Click (object sender, EventArgs e)
{
Button1.Text = "Hello i im a webapplication!!";
}
}
}
------------------------------------------------------
New Web WebSite1
Drag a button
Code in Default.aspx:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;


public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{


}
protected void Button1_Click (object sender, EventArgs e)
{
Button1.Text = "Everybody is good, I am WebSite1";
Button1.Text = "Everybody is good, I am website credream";
}
}
------------------------------------------------------------------
Difference:
1.website1, modify the code, and then directly refresh the browser can reflect
WebApplication can only be reflected after republishing
2.website1 is not namespace, WebApplication1 is namespace.
3.WebSite is designed to be compatible with the habits of developers who turn from ASP, and it is simple to use
No need to create namespaces, CS code changes do not need to restart to see changes
4.WebApplication the entire application is compiled into a DLL
Website each CS file is compiled into a DLL
Website changes immediately after the response, but also because each CS file is compiled into a separate
Dll
The disadvantage of 5.WebSite:
Only one namespace, not conducive to the development of engineering, error is not easy to find
6. Small sites with website, large sites with WebApplication
7.WebSite can be converted to WebApplication by right key, very convenient
---------------------------------------------------------------------------
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.