Category: ASP Net
-
ASP.NET Web Pages – Classes
ASP.NET Classes Reference Method Description AsBool(), AsBool(true|false) Converts a string value to a Boolean value (true/false). Returns false or the specified value if the string does not represent true/false. AsDateTime(), AsDateTime(value) Converts a string value to date/time. Returns DateTime. MinValue or the specified value if the string does not represent a date/time. AsDecimal(), AsDecimal(value) Converts…
-
ASP.NET Web Pages – WebSecurity Object
Description The WebSecurity Object provides security and authentication for ASP.NET Web Pages applications. With the WebSecurity object you can create user accounts, login and logout users, reset or change passwords, and more. WebSecurity Object Reference – Properties Properties Description CurrentUserId Gets the ID for the current user CurrentUserName Gets the name of the current user HasUserId Returns…
-
ASP.NET Web Pages – The WebMail Helper
The WebMail Helper The WebMail Helper makes it easy to send an email from a web application using SMTP (Simple Mail transfer Protocol). Scenario: Email Support To demonstrate the use of email, we will create an input page for support, let the user submit the page to another page, and send an email about the…
-
ASP.NET Web Pages – The WebGrid Helper
Doing the HTML Yourself In a previous chapter, you displayed database data by using razor code, and doing the HTML markup yourself: Database Example Using The WebGrid Helper Using the WebGrid helper is an easier way to display data. The WebGrid helper: WebGrid Example WebGrid Object Reference Helper Description WebGrid(data) Creates a new WebGrid object…
-
ASP.NET Web Pages – Helpers
ASP.NET Helpers ASP.NET helpers are components that can be accessed by single lines of Razor code. You can build your own helpers using Razor syntax stored as .cshtml files, or use built-in ASP.NET helpers. You will learn how to use Razor helpers in the next chapters of this tutorial. Below is a short description of…
-
ASP.NET Web Pages – Databases
What We Will Do In this chapter we will: Displaying Data from Database With Web Pages, you can easily display data from a database. You can connect to an existing database, or create a new database from scratch. In this example we will connect to an existing SQL Server Compact database. Adding a Customers Page…
-
ASP.NET Web Pages – Files
Working with Text Files Sometimes you will want to access data stored in text files. Text files used to store data is often called flat files. Common flat file formats are .txt, .xml, and .csv (comma-delimited values). In this chapter you will learn: Add a Text File Manually In the example to follow, you will…
-
ASP.NET Web Pages – Objects
The Page Object You have already seen some Page Object methods in use: @RenderPage(“header.cshtml”) @RenderBody() In the previous chapter you saw two Page Object properties being used (IsPost, and Request): If (IsPost) { if (Request[“Choice”] != null) { Some Page Object Methods Method Description href Builds a URL using the specified parameters RenderBody() Renders the…
-
ASP.NET Web Pages – HTML Forms
Creating an HTML Input Page Razor Example Razor Example – Displaying Images Suppose you have 3 images in your image folder, and you want to display images dynamically by the users choice. This is easily done by a little Razor code. If you have an image called “Photo1.jpg” in your images folder on your web…
-
ASP.NET Web Pages – Global Pages
Before Web Startup: _AppStart Most server side code are written inside individual web pages. For example, if a web page contains an input form, the web page typically contains server code for reading the data. However, by creating a page named _AppStart in the root of your site, you can have startup code executed before…