First, simple Web site creation:
1. First Open VS,
2. Document--"new--" website--"ASP."
3. The system will generate a default.aspx file by default, the contents of the file are as follows:
<%@ Page language= "C #" codefile= "Default.aspx.cs" inherits= "_default"%> <!
DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
4. We can through the "design" mode, drag and drop to complete the page design, the code will be automatically generated.
5. Here, we drag a lable control to display "Hello" when the page loads.
6. After dragging the controls, we found "Default.aspx.cs", the code file, to complete the writing of the event. "Here's the idea of separating the code from the page."
The code is as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{
Label1.Text = "Hello";
}
}
At this point, code writing is complete.
Second, deployment.
Deployment is mainly divided into two ways, one for debugging the random debugging; one for formal deployment.
How to deploy this machine:
"Debug"-"Start Debugging"-"Add a new debug-enabled Web.config file"-"OK;"
The deployment has been completed at this time. This method can also be run without IIS on this computer.
Formal Deployment mode:
Build-"Build Web Site": A DLL file and a paging file are generated at this time.
"Generate"-"Publish Web Site": Select the path to publish--"OK;"
This is where we move to the path and you can see the following figure:
We can copy the generated files and put them in a directory on the server to be published.
Click on the directory and right-click to select "Properties"-Web Sharing tab
Shared location "Default Web Site", click "Shared Folder", which will pop up
Alias can be arbitrary, click "OK", run in IIS.
The above is the asp.net of the creation and release process, is not the operation is very simple, hurry to release their own site to try it!