ASPNet培训.ppt

上传人:啊飒飒 文档编号:11945740 上传时间:2021-11-12 格式:PPT 页数:93 大小:1.09MB
返回 下载 相关 举报
ASPNet培训.ppt_第1页
第1页 / 共93页
ASPNet培训.ppt_第2页
第2页 / 共93页
ASPNet培训.ppt_第3页
第3页 / 共93页
ASPNet培训.ppt_第4页
第4页 / 共93页
ASPNet培训.ppt_第5页
第5页 / 共93页
点击查看更多>>
资源描述

《ASPNet培训.ppt》由会员分享,可在线阅读,更多相关《ASPNet培训.ppt(93页珍藏版)》请在三一文库上搜索。

1、ASP.NET Development,Agenda,What is ASP.NET? Web Forms Server Controls Step 2: Call DataBind Sub Page_Load(s As Object, e As EventArgs) DataGrid1.DataBind() End Sub,Binding To Templated Lists,Templates enable “Lookless” UI Customize structure not just style Controls can be nested within templates Rep

2、eater, DataList, DataGrid Container: alias for the item created from the template + data Container.DataItem “this row of data”,Templated List Example, Sub Page_Load(s as Object, e as EventArgs) DataList1.DataSource = GetCustData() DataList1.DataBind() End Sub ,DataBinder.Eval Method,Helper method fo

3、r late-bindingbefore: after: Optional 3rd param for formatting ,ASP.NET Databinding,demo,Agenda,What is ASP.NET? Web Forms Server Controls & User Controls Databinding ASP.NET Pages ASP.NET Caching ASP.NET Configuration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web Applications,Page Out

4、put Caching,Pages that dont change frequently Dramatic performance increase ,Fragment Caching,Dynamic portions of a page Data doesnt change frequently User control ,Cache APIs,Programmatically cache data Cache.Insert( _ Key, _ Value, _ CacheDependency, _ AbsoluteExpiration, _ SlidingExpiration, _ Pr

5、iority, _ PriorityDecay, _ Callback),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,Cache APIs,AbsoluteExpiration Cache item can expire at some fixed time. S

6、lidingExpiration Cache item can expire after a certain amount of inactivity Priority When forcing items from the cache, which items should go first,Cache APIs,ASP.NET Cache,demo,Agenda,What is ASP.NET? Web Forms Server Controls & User Controls Databinding ASP.NET Pages ASP.NET Caching ASP.NET Config

7、uration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web Applications,Web.config,Site configuration file Ships with the site Stores most configuration options Eases maintenance and deployment Changes take effect immediately,Hierarchical Architecture,Web.config files and their settings are

8、 inherited in a hierarchy Machine settings (WinntMicrosoft.NETVersion) Web application root directory Subdirectories,Settings can be targeted at a specified set of file/directory by use of the tag ,Hierarchical Architecture,Default Configuration Settings,Machine.config TracingDisabled Execution time

9、out90 seconds Session stateEnabled, inproc AuthenticationAllow anonymous Multiple CPU supportDisabled,Custom Configuration Settings,Examples of customization AppSettings CustomErrors Trace settings Authentication Session settings,Custom setting in web.config Accessing with code DSN = ConfigurationSe

10、ttings.AppSettings(DSN),AppSettings,Redirect certain errors to certain pages ,CustomErrors,Trace Configuration Writing to trace log Trace.Write(Page_Load,Entering Event) Trace.Warn(“Login,Invalid Argument),Tracing,Tracing,Enabled Tracing information will be stored. Information can be accessed throug

11、h “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,ASP.NET Configuration,demo,Agenda,What is ASP.NET? Web Forms Server Contr

12、ols & User Controls Databinding ASP.NET Pages ASP.NET Caching ASP.NET Configuration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web Applications,Security Concepts,Authentication Authorization Impersonation,Authentication,Windows Basic Digest Integrated Form Passport,Windows Authenticatio

13、n,Enabled for IIS through Internet Services Manager,Enabled for ASP.NET through web.config ,Windows Authentication,Site can easily access user name Dim UserName As String UserName = User.Identity.Name NT groups automatically map to ASP.NET roles If User.IsInRole(Administrators) Then,Windows Authenti

14、cation,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 Any unauthenticated user will get sent to Login.aspx,Form Authentication,You code a form to collect user ID and password After authenticate a user

15、: 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,Form Authentication,Declar

16、ative Form Authentication,For simple sites, you can store user ID and password in web.config User is authenticated by calling FormsAuthentication.Authenticate(UserName, Password),Programmatic Form Authentication,Code is used to authenticate the user If UserFoundInDataBase then FormAuthentication.Red

17、irectFromLoginPage(UserName,false) Else lblLoginError.Text = User Not Found or Invalid Password end if,Role Based Security,Jane,Jill,John,Jenny,Jamie,RD,Admins,Page RD Content,Admin Content,Programmatically assigning users to roles Sub Application_AuthenticateRequest(ByVal Sender As Object, ByVal e

18、As EventArgs) If request.IsAuthenticated = True Then sql = select role from roles where userid= & UserID & Get Roles from Result Set context.User = New GenericPrincipal(user, roles) End If End Sub,Role Based Security,Display content based on roles If User.IsInRole(HumanRes) Then cmdEditSalary.Visibl

19、e = true End If,Role Based Security,Impersonation,Windows authentication web.config ,ASP.NET Security,demo,Agenda,What is ASP.NET? Web Forms Server Controls & User Controls Databinding ASP.NET Pages ASP.NET Caching ASP.NET Configuration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web App

20、lications,Application_OnStart Application_OnEnd Session_OnStart Session_OnEnd,Traditional ASP (Global.asa),ASP.NET Global.asax,First request Application_Start First request for each user Session_Start Each request Application_BeginRequest Application_Authenticate Application_EndRequest Application e

21、rror Application_Error User logs out/session times out Session_End Web server shutdown Application_End,Application_BeginRequest 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 e-mail or writin

22、g to the event log when an error occurs that was not properly handled at the source of the error,Global.asax Event Usage,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 a

23、n entry out to the event log Application_Start Useful for loaded site specific configuration information,Global.asax Event Usage,Essentially global variables for the application Application (CompanyName) Can lock or unlock application state variables Application.lock Application (GlobalCounter) = Ne

24、wValue Application.unlock,Saving Application State,Per-user variables Available to all pages in the site Session (UserID) = 5 UserID = Session (UserID),Saving Session State,ASP session state Dependent on cookies Not fault tolerant ASP.NET session state Support for Web gardens and server farms Doesnt

25、 require cookies Better fault tolerance - Proc, State Server, SQL Server,ASP vs. ASP.NET Session State,Configuration information stored in web.config ,Configuring Session State,Mode InProc Conventional session variables, stored in memory on the Web server Stateserver Sessions are stored on an extern

26、al 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,Configuring Session State,SQLConnectionString Contains the datasource, userid, and passwor

27、d parameters necessary to connect to a SQL database that holds the session state stateConnectionString Contains information needed to connect to the state server,Configuring Session State,You must run a small T-SQL script on the target server Install SQLState.sql which can be found in sysdrivewinntM

28、icrosoft.NETFrameworkversion Creates the following on the server A database called ASPState Stored procedures Tables in TempDB to hold session data Uninstall via UninstallSQLState.sql,Storing Session in SQL Server,Agenda,What is ASP.NET? Web Forms Server Controls & User Controls Databinding ASP.NET

29、Pages ASP.NET Caching ASP.NET Configuration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web Applications,Deployment,Install XCopy No Registering DLLs No Locked DLLs Apps are Isolated Each App Can Have Its Own Version Uninstall Delete,Summary,What is ASP.NET? Web Forms Server Controls & U

30、ser Controls Databinding ASP.NET Pages ASP.NET Caching ASP.NET Configuration ASP.NET Security ASP.NET Applications Deploying ASP.NET Web Applications, 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1