asp.net with visual studio.net name title department microsoft corporation
DESCRIPTION
ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation. What we will cover. Web Forms Usage of Global.asax How to work with Session State How to secure ASP .NET Applications Usage of Web.Config Caching Monitoring ASP .NET Applications. Session Prerequisites. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/1.jpg)
ASP.NET With Visual Studio.NET
NameTitleDepartmentMicrosoft Corporation
![Page 2: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/2.jpg)
What we will cover Web Forms Usage of Global.asax How to work with Session State How to secure ASP .NET Applications Usage of Web.Config Caching Monitoring ASP .NET Applications
![Page 3: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/3.jpg)
Session Prerequisites Web Development ASP Programming Microsoft ADO Understanding of XML
Level 300
![Page 4: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/4.jpg)
Agenda Web Forms ASP.NET Applications Web Application Security Configuration and Monitoring
![Page 5: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/5.jpg)
Web FormsWhat is Web Forms? Code Model Life Cycle Server Side Events Server Controls Validation
![Page 6: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/6.jpg)
Web FormsCode Model
Code Behind Logic – Presentation Separation Object Orientated Event Driven
![Page 7: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/7.jpg)
Web FormsASP.NET Page Life Cycle
Similar to Win32 Application Coding Events Raised as Page Created
Form_Initialize() ~ Page_Init()Form_Load() ~ Page_Load()Form_Activate() ~ Page_PreRender()Form_Unload() ~ Page_Unload()
![Page 8: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/8.jpg)
Web FormsServer Side Events
Runat=“server” <form runat=“server”> <input type=button id=button1 OnServerClick=“Button1_Click” runat=“server” /> Button1_Click(Sender as Object, e as EventArgs) Button1.Text = “Save”
![Page 9: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/9.jpg)
Web FormsServer Controls
45 Built In Controls Target any HTML 3.2 browser Raise Events to Server Basic Controls
textbox, checkbox, radio, button Advanced Controls
AdRotator, Calendar, DataGrid, Validator
![Page 10: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/10.jpg)
Web FormsBasic Server Controls <asp:textbox id=text1 runat=server/>
text1.text = “Hello World” <asp:checkbox id=check1
runat=server/>check1.checked=True
<asp:button id=button1 runat=server/>button1_onClick()
<asp:DropDownList id=DropDownList1 runat=server>DropDownList1.SelectedItem.Text = “Hello”
![Page 11: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/11.jpg)
Web FormsAdvanced Server Controls
DataGrid Defined by <asp:datagrid /> Column Sorting In-Line Editing HTML Table DataBinding Paging
![Page 12: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/12.jpg)
Web FormsAdvanced Server Controls Validation
Required Validator Control Range Validator Control Compare Validator Control Regular Expression Validator Custom Validator Control Example:
<asp:RequiredFieldValidator ControlToValidate="txtName" ErrorMessage="Please Enter Your Name" runat="server" />
![Page 13: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/13.jpg)
Demonstration 1Web Forms
Code and Page ModelEvent Model
Server Controls
![Page 14: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/14.jpg)
Agenda Web Forms ASP.NET Applications Web Application Security Configuration and Monitoring
![Page 15: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/15.jpg)
Application_OnStart Application_OnEnd Session_OnStart Session_OnEnd
ASP.NET ApplicationsTraditional ASP (global.asa)
![Page 16: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/16.jpg)
ASP.NET ApplicationsGlobal.ASAX events First Request
Application_Start First Request for Each User
Session_Start Each Request
Application_BeginRequest Application_Authenticate Application_EndRequest
Application Error Application_Error
User Logs Out/Session Times Out Session_End
Web Server Shutdown Application_End
![Page 17: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/17.jpg)
Application_BeginRequest Virtual Resources Text to be included at the start of every page
Application_EndRequest Text to be added to the end of every page
Application_Error Useful for sending out an email or writing to the
event log when an error occurs that was not properly handled at the source of the error
ASP.NET ApplicationsGlobal.ASAX Event Usage
![Page 18: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/18.jpg)
Session_End Writing to a log file or database that a user has
logged out at a given time Application_End
Useful for writing out when the web application had to stop. Could write an entry out to the event log
Application_Start Useful for loaded site specific configuration
information
ASP.NET ApplicationsGlobal.ASAX Event Usage
![Page 19: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/19.jpg)
Essentially global variables for the application
Application(“CompanyName”)Can lock or unlock Application State
Variables Application.lock Application(“GlobalCounter”) = NewValue Application.unlock
ASP.NET ApplicationsSaving Application State
![Page 20: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/20.jpg)
Per User Variables Available to All Pages in the Site Session(“UserID”) = 5 UserID = Session(“UserID”)
ASP.NET ApplicationsSaving Session State
![Page 21: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/21.jpg)
ASP Session State Forces “Server Affinity” Dependent on cookies Not fault tolerant
ASP .NET Session State Support for Web Gardens and Server Farms Doesn’t require cookies Better fault tolerance
ASP.NET ApplicationsASP vs. ASP .NET State
![Page 22: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/22.jpg)
Configuration information stored in Web.Config
<sessionStateInproc=“true”mode=“sqlserver” cookieless=“false”timeout=“20”sqlconnectionstring=“data source=127.0.0.1;user id=sa;password=“”
stateConnectionString="tcpip=127.0.0.1:42424" /></sessionState>
ASP.NET ApplicationsConfiguring Session State
![Page 23: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/23.jpg)
Mode InProc – Conventional session variables. Stored in-
memory on the web server. Stateserver – Sessions are stored on an external server,
in memory. SQLServer – Sessions are stored in a SQL database.
Cookieless Determines if Cookieless sessions should be used Values are true or false
TimeOut Determines the default timeout for the web site
ASP.NET ApplicationsConfiguring Session State
![Page 24: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/24.jpg)
SQLConnectionString contains the datasource, userid, and password
parameters necessary to connect to a sql database that holds the session state
stateConnectionString Contains information needed to connect to the
state server.
ASP.NET ApplicationsConfiguring Session State
![Page 25: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/25.jpg)
In order to setup the SQL Server to store state information you must run a small T-SQL script on the target server
InstallSQLState.sql can be found in [sysdrive]\winnt\Microsoft.NET\Framework\[version]
Creates the following on the server A database called ASPState Stored Procedures Tables in TempDB to hold session data.
Uninstall is via UninstallSQLState.sql
ASP.NET ApplicationsStoring Data in SQL Server
![Page 26: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/26.jpg)
Demonstration 2ASP.NET Applications
Uses for Global.asaxSaving Application State
![Page 27: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/27.jpg)
Agenda Web Forms ASP.NET Applications Web Application Security Configuration and Monitoring
![Page 28: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/28.jpg)
Web Application SecuritySecurity Concepts Authentication Authorization Impersonation
![Page 29: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/29.jpg)
Web Application SecurityAuthentication Windows
Basic Digest Integrated
Passport Form
![Page 30: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/30.jpg)
Web Application SecurityWindows Authentication Enabled For IIS Through Internet
Services Manager
![Page 31: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/31.jpg)
Web Application SecurityWindows Authentication Enabled for ASP.NET Through
Web.config
<security><authentication
mode="Windows" /></security>
![Page 32: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/32.jpg)
Web Application SecurityWindows Authentication Site Can Easily Access User Name
Dim UserName As StringUserName = User.Identity.Name
NT Groups Automatically Map to ASP.NET Roles
If User.IsInRole(“Administrators”) Then…
![Page 33: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/33.jpg)
Web Application SecurityForm Authentication Web Site is Responsible for Security, not IIS
Configure IIS to allow anonymous access Set Web.Config to force users to authenticate through a
form<authentication mode="Forms"><forms loginUrl="Registration.aspx"></forms></authentication><authorization><deny users="?" /></authorization>
Any Unauthenticated User Will Get Sent to “Registration.aspx”
![Page 34: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/34.jpg)
Web Application SecurityForm Authentication You Code a Form to Collect User ID and
Password To Authenticate a User:
FormAuthentication.RedirectFromLoginPage(UserName, False)
RedirectFromLoginPage Marks the user as authenticated Takes the user to the page they originally
requested If the user requested the login page, takes the
user to Default.aspx Can persist authentication in a cookie
![Page 35: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/35.jpg)
Web Application SecurityForm Authentication - Declarative For Simple Sites, You Can Store User
ID and Password in Web.config
<credentials passwordFormat="clear"><user name="MSDN"
password="online" /><user name="Guest"
password="guest" /></credentials>
![Page 36: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/36.jpg)
Web Application SecurityForm Authentication - Declarative User is Authenticated by Calling
FormsAuthentication.Authenticate( _UserName, Password)
![Page 37: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/37.jpg)
Web Application SecurityForm Authentication - Programmatic Code is Used to Authenticate the User
SQL = “Select * From Users ” & _“Where UserID = ‘” & UserName & “’”
If UserFoundInDataBase thenFormAuthentication.RedirectFromLoginPage(UserNam e,false)
ElselblLoginError.Text = “User Not Found or Invalid Password”
end if
![Page 38: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/38.jpg)
Web Application SecurityRoles
JaneJane
JillJillJohnJohn
JennyJennyJamieJamie
RDRD
AdminsAdmins
PagePageRD ContentRD Content
Admin ContentAdmin Content
![Page 39: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/39.jpg)
Web Application SecurityRoles Build the Application In Terms of Roles
Access to Pages Custom Page Content
After Deployment, Assign Users To Roles
![Page 40: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/40.jpg)
Web Application SecurityRoles Programmatically Assigning Users to
Roles
Sub Application_AuthenticateRequest(ByVal Sender As Object, ByVal e As EventArgs)
If request.IsAuthenticated = True Thensql = “select role from roles where userid=‘“
& UserID & “’”
‘ Get Roles from Result Setcontext.User = New GenericPrincipal(user,
roles)End If
End Sub
![Page 41: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/41.jpg)
Web Application SecurityRoles Display Content Based on Roles
If User.IsInRole(“HumanRes”) ThencmdEditSalary.Visible = true
End If
![Page 42: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/42.jpg)
Web Application SecurityImpersonation Windows Authentication Web.config
<identity> <impersonation enable="true" name="username" password="password" />
</identity>
![Page 43: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/43.jpg)
Demonstration 3Web Application Security
Windows AuthenticationForm Based Registration
Form Based AuthenticationAssigning Users to Roles
![Page 44: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/44.jpg)
Agenda Web Forms ASP .NET Applications Web Application Security Configuration and Monitoring
![Page 45: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/45.jpg)
Configuration and OptimizationWeb.Config
Site Configuration File Ships with the Site Stores Most Configuration Options Eases Maintenance and Deployment Changes Take Effect Immediately
![Page 46: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/46.jpg)
Configuration and OptimizationHierarchical Configuration Architecture Web.Config files and their settings are inherited in a hierarchy
Machine Settings (Winnt\Microsoft .NET\Version\) Web Application Root Directory Sub directories
![Page 47: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/47.jpg)
Configuration and OptimizationHierarchical Configuration Architecture
Settings can be targeted at a specified set of files/directories by use of the <location> tag
<configuration><location path=“/admin”>
<system.web><security>
<authorization><allow roles=“Admins”></authorization>
</security></system.web>
</location></configuration>
![Page 48: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/48.jpg)
Configuration and OptimizationDefault Configuration Settings Machine.config
Tracing Disabled Execution Timeout90 Seconds Session State Enabled, Inproc Authentication Allow Anonymous Multi CPU Support Disabled
![Page 49: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/49.jpg)
Configuration and OptimizationCustom Configuration Settings Examples of Customization
AppSettings CustomErrors Trace Settings Authentication Session Settings Browser Capabilities
![Page 50: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/50.jpg)
Configuration and OptimizationCustom Configuration Settings Custom Setting in Config.Web
<configuration><appSettings><add key="DSN" value="server=localhost…</appSettings></configuration>
Accessing with Code
DSN = ConfigurationSettings.AppSettings("DSN")
![Page 51: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/51.jpg)
Configuration and OptimizationCustom Configuration Settings Redirect Certain Errors to Certain
Pages
<customErrors mode="On"><error statusCode="404" redirect="errorpage404.aspx" />
</customErrors>
<customErrors mode=“RemoteOnly"><error statusCode="404" redirect="errorpage404.aspx" />
</customErrors>
![Page 52: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/52.jpg)
Configuration and OptimizationCustom Configuration Settings Tracing
<trace enabled=“true" requestLimit="10" pageOutput=“true" traceMode="SortByTime" />
![Page 53: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/53.jpg)
Configuration and OptimizationCustom Configuration Settings Trace Options
Enabled Tracing information will be stored. Information can be accessed through
http://site/trace.axd RequestLimit
Store tracing information for this many requests PageOutput
Allows trace output to also appear at the bottom of the page. TraceMode
Allows trace information to be sorted by time or category.
![Page 54: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/54.jpg)
Configuration and OptimizationCustom Configuration Settings Writing to the Trace Log
Trace.Write(“Page_Load”,”Entering Event”)Trace.Warn(“GetCustomer”,”Invalid Argument”)
![Page 55: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/55.jpg)
Demonstration 4Configuration and
Optimization
ASP.NET Configuration
![Page 56: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/56.jpg)
Configuration and OptimizationPage Output Caching Pages That Don’t Change Frequently Dramatic Performance Increase
<%@ OutputCache Duration= "500" %>
![Page 57: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/57.jpg)
Configuration and OptimizationFragment Caching Dynamic Portions of a Page Data Doesn’t Change Frequently User Control
<%@ OutputCache Duration=“60" %>
![Page 58: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/58.jpg)
Configuration and OptimizationCache API’s Programmatically Cache Data
Cache.Insert( _Key, _Value, _CacheDependency, _AbsoluteExpiration, _SlidingExpiration, _Priority, _PriorityDecay, _Callback)
![Page 59: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/59.jpg)
Configuration and OptimizationCache API’s Key
String used to look up the cached item Value
Item or object to store in the cache CacheDependency
Cache item can automatically expire when a file, directory, or other cache item changes
![Page 60: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/60.jpg)
Configuration and OptimizationCache API’s AbsoluteExpiration
Cache item can expire at some fixed time (midnight, for example)
SlidingExpiration Cache item can expire after a certain amount of
inactivity Priority
When forcing items from the cache, which items should go first
PriorityDecay Within a given priority range, does this item
expire fast or slow
![Page 61: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/61.jpg)
Demonstration 5Configuration and
Optimization
ASP.NET Caching
![Page 62: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/62.jpg)
Configuration and MonitoringMonitoring ASP.NET Applications Monitoring Tool Integration
Performance Monitor Tracing Support Service Control and Monitoring
![Page 63: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/63.jpg)
Configuration and Monitoring Performance Counters Some Counters are now more
application specific as oppossed to server specific for traditional ASP
Counter Groups Global Performance Counters Application Specific Counters
![Page 64: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/64.jpg)
Configuration and Monitoring Global Performance Counters Global Performance Counters
Application Restarts Applications Running Requests Queued Request Wait Time
![Page 65: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/65.jpg)
Configuration and Monitoring Application Specific Counters Application Performance Counters
Cache Total Entries Cache Total Hit Ratio Request Bytes in Total Requests Executing Requests Timed Out Sessions Timed Out
![Page 66: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/66.jpg)
Configuration and Monitoring PerformanceCounter Class The PerformanceCounter class allows
you to access counter data from code
Dim Req_Bytes_Total As New PerformanceCounter(“asp .net applications", “Request Bytes Out Total”, _Total_)
Dim s as IntegerS = Req_Bytes_Total.NextValue()
The same code can be used to retrieve standard counters as well
![Page 67: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/67.jpg)
Configuration and Monitoring Tracing Tracing
Timing information between successive trace output statements
Information about the server control hierarchy
The amount of viewstate used Render size of controls on your page
![Page 68: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/68.jpg)
Configuration and Monitoring Tracing Enable Tracing for a specific page
<%@ Page trace=true Language="vb" AutoEventWireup="false" Codebehind="Write_Trace_Info.aspx.vb" Inherits="Opt_Monitor.Write_Trace_Info"%>
Writing Custom Trace Statements
Trace.Write(“Custom Trace”, “Begin Load DataSet”)
![Page 69: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/69.jpg)
Configuration and MonitoringAccessing Services ServiceController class
Allows you to access locally or remote services Constructor
Takes ServiceName as Parameter Methods
Stop Start Pause WaitForStatus
Srv.WaitForStatus(ServiceControllerStatus.Stopped, System.TimeSpan.FromSeconds(30))
Allows you to easily wait for the service state to change to the desired state before continuing
Properties MachineName
Gets or sets the machine name
![Page 70: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/70.jpg)
Configuration and MonitoringChecking Service State Checking the Service State
Protected Sub CheckServiceState(ByVal ServiceName As String) as String
Dim Srv As New ServiceController(ServiceName)Select Case Srv.Status
Case ServiceControllerStatus.Running CheckServiceState = "Started" Case ServiceControllerStatus.Stopped CheckServiceState = "Stopped"
Case Else CheckServiceState = "Unknown"
End Select End Sub
![Page 71: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/71.jpg)
Demonstration 6Configuration and
Optimization
ASP .NET Optimization and Monitoring
![Page 72: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/72.jpg)
Session Summary Web Forms ASP .NET Applications Web Application Security Configuration and Monitoring
![Page 73: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/73.jpg)
For More Information… MSDN Web Site at
msdn.microsoft.com ASP.NET Related Sites at
msdn.microsoft.com/library/dotnet/cpguide/cpconaspwebforms.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconaspnetapplications.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconaspstatemanagement.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconoptimizingaspapplications.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconsecuringaspnetwebapplications.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconaspcachingfeatures.htm msdn.microsoft.com/library/dotnet/cpguide/
cpconaspnetconfigurationconcepts.htm
![Page 74: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/74.jpg)
MS PressEssential Resources for Developers
Now you can Now you can build your own custombuild your own custom MS Press books at MS Press books at
mspress.microsoft.com/custombookmspress.microsoft.com/custombookChoose from Windows 2000, SQL Server 200, Exchange 2000, Office 2000 Choose from Windows 2000, SQL Server 200, Exchange 2000, Office 2000
and XMLand XML
Build it and then order it on either MS Reader, PDF, or printed versionsBuild it and then order it on either MS Reader, PDF, or printed versions
![Page 75: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/75.jpg)
TrainingTraining Resources for Developers Introduction to ASP.NET
Course 2063 Available: Now
Building and Using Web Services with Visual Studio.NET Course 2504 Available: July 2001
To locate a training provider for this course, please accessTo locate a training provider for this course, please access
mcspreferral.microsoft.com/default.aspmcspreferral.microsoft.com/default.aspMicrosoft Certified Technical Education Centers (CTECs) Microsoft Certified Technical Education Centers (CTECs)
are Microsoft’s premier partners for training servicesare Microsoft’s premier partners for training services
![Page 76: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/76.jpg)
Training & Training & EventsEvents
MSDN Training, Tech-Ed, PDC, MSDN Training, Tech-Ed, PDC, Developer Days, MSDN/Onsite EventsDeveloper Days, MSDN/Onsite Events
MSDNEssential Resources for Developers
Subscription Subscription ServicesServices
OnlineOnlineInformationInformation
MembershipMembershipProgramsPrograms
Print Print PublicationsPublications
Library, Professional, UniversalLibrary, Professional, UniversalDelivered via CD-ROM, DVD, WebDelivered via CD-ROM, DVD, Web
MSDN Online, MSDN FlashMSDN Online, MSDN Flash
MSDN User GroupsMSDN User Groups
MSDN MagazineMSDN MagazineMSDN NewsMSDN News
![Page 77: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/77.jpg)
Where Can I Get MSDN? Visit MSDN Online at
msdn.microsoft.com Register for the MSDN Flash
Email Newsletter at msdn.microsoft.com/resources/msdnflash.asp
Become an MSDN CD Subscriber at msdn.microsoft.com/subscriptions
Attend More MSDN Events
![Page 78: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/78.jpg)
Become A Microsoft Certified Solution Developer What Is MCSD?
Premium certification for professionals who design and develop custom business solutions
How Do I Get MCSD Status? It requires passing four exams to prove competency
with Microsoft solution architecture, desktop applications, distributed application development, and development tools
Where Do I Get More Information? For more information about certification
requirements, exams, and training options, visit www.microsoft.com/mcp
![Page 79: ASP.NET With Visual Studio.NET Name Title Department Microsoft Corporation](https://reader035.vdocuments.site/reader035/viewer/2022062501/56815cbb550346895dcab98e/html5/thumbnails/79.jpg)