Home  >  Article  >  Backend Development  >  Resource sharing about ASP.NET video tutorials

Resource sharing about ASP.NET video tutorials

黄舟
黄舟Original
2018-05-15 14:37:553540browse

《ASP.NET Tutorial》 ASP.NET is a development framework that uses HTML, CSS, JavaScript and server scripts to create web pages and websites. ASP.NET supports three different development modes: Web Pages (Web page), MVC (Model View Controller model-view-controller), Web Forms (Web Form): Web Pages single page mode MVC model-view-control Web Forms event-driven model

Resource sharing about ASP.NET video tutorials

Course playback address: http://www.php.cn/course/83.html

The teacher’s teaching style:

The teacher’s lectures are simple, clear, layer-by-layer analysis, interlocking, rigorous argumentation, rigorous structure, and use the logical power of thinking to attract students’ attention Strength, use reason to control the classroom teaching process. By listening to the teacher's lectures, students not only learn knowledge, but also receive thinking training, and are also influenced and influenced by the teacher's rigorous academic attitude

The more difficult point in this video is Web Pages:

Three programming models Web Pages, Web Forms and MVC (Model, View, Controller)

Web Pages is the simplest ASP .NET web development programming model. It provides a simple way to combine HTML, CSS, JavaScript and server code:
Easy to learn, read and use
Build around a single web page

Similar to PHP and ASP

Server Scripting using Visual Basic or C
#Full control over HTML, CSS, JavaScript

Web Pages are extended with programmable Web Helpers to include databases, videos, Images, social networks and more.

A Razor web page can be described as an HTML page with two kinds of content: HTML content and Razor code.

When the server reads this kind of page, it will first run the Razor code before sending the HTML page to the browser. These codes executed on the server can complete tasks that cannot be completed in the browser, such as accessing the server database. Server code can create dynamic HTML content before the page is sent to the browser. From a browser perspective, there is no difference between HTML generated by server code and static HTML content.

Layout (such as header and footer).

With Web Pages, you can use the @RenderPage() method to import content from different files.

<html>
<body>
@RenderPage("header.cshtml")
<h1>Hello Web Pages</h1> 
<p>This is a paragraph</p>
@RenderPage("footer.cshtml")
</body>
</html>

Using the layout page The layout page is similar to an ordinary web page, but the @RenderBody() method will be called at the location of the referenced content page. Every content page must begin with a Layout directive. This is the code: Layout web page:

<html>
<body>
<p>This is header text</p>
@RenderBody()
<p>© 2012 W3School. All rights reserved.</p>
</body>
</html>

Any web page:

@{Layout="Layout.cshtml";}

<h1>Welcome to W3Schools</h1>

<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor 
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat.
</p>

ASP.NET provides three tools for processing folder paths: ~ operator, Server.MapPath method as well as the Href method.

~ Operator

To specify the virtual root directory in programming code, use the ~ operator.

If you use the ~ operator instead of a path, you can move the website to a different folder or location without changing any code:

var myImagesFolder = "~/images";
var myStyleSheet = "~/styles/StyleSheet.css";

Server.MapPath method

The Server.MapPath method converts the virtual path (/default.cshtml) to a physical path that the server can understand (C:\Johnny\MyWebSited\Demo\default.cshtml).

You will use this method when you need to open a data file located on the server (the data file can only be accessed through the complete physical path):

var pathName = "~/dataFile.txt";
var fileName = Server.MapPath(pathName);

The above is the detailed content of Resource sharing about ASP.NET video tutorials. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn