Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Applications using ASP.NET and C# / Session 14 / 1 of 18 Session 14.

Similar presentations


Presentation on theme: "Building Applications using ASP.NET and C# / Session 14 / 1 of 18 Session 14."— Presentation transcript:

1 Building Applications using ASP.NET and C# / Session 14 / 1 of 18 Session 14

2 Building Applications using ASP.NET and C# / Session 14 / 2 of 18 Session Objectives Discuss: Machine.Config Secure your web pages using Authentication Web.Config Structure of a configuration file

3 Building Applications using ASP.NET and C# / Session 14 / 3 of 18 Web Pages – Web Application Web Page --------- WEB APPLICATION

4 Building Applications using ASP.NET and C# / Session 14 / 4 of 18 Configuration Files Stored in plain text format No need to restart server in case of changes to file Written in XML. Rules for naming tags and attributes Clients cannot view the file from browser Each directory can have its own file Each directory overrides earlier configuration file Tag and attribute names Attribute values FEATURESFEATURES

5 Building Applications using ASP.NET and C# / Session 14 / 5 of 18 Types of Configuration Files - 1 Machine.config Settings are applied to all the applications residing on the server Settings are applied to single application residing on the server XML based file Stored in C:\WinNT\Microsoft.NET\Framework\v.1.xxxx\config Build number of.net CLR Web.config Only one file per ASP.net installation on a machine XML based file One file per each directory of the web application

6 Building Applications using ASP.NET and C# / Session 14 / 6 of 18 Types of Configuration Files - 2 Web Applications One per machine One per application Override settings of machine.config

7 Building Applications using ASP.NET and C# / Session 14 / 7 of 18 Typical Web.config File ” /> Configuration section Handler Declaration Area Configuration section Settings Area

8 Building Applications using ASP.NET and C# / Session 14 / 8 of 18 Page Configuration Setting <pages buffer=”false” enableViewState=”true” /> Response to the client can be buffered View state can be set

9 Building Applications using ASP.NET and C# / Session 14 / 9 of 18 Application Setting Configuration settings in form of key-value pair The settings are read in ASP.NET page... String GetQuery = Configuration.AppSettings(“MyQuery”);...

10 Building Applications using ASP.NET and C# / Session 14 / 10 of 18 Compilation Setting <compilation debug="true" defaultLanguage=”C#”/> Specifies whether to compile retail binaries or debug binaries. Provides a semicolon-separated list of language names to use in dynamic compilation of files

11 Building Applications using ASP.NET and C# / Session 14 / 11 of 18 Sub-tags of Compilation tag -1 <compilation debug="true" defaultLanguage=”C#”/> addremoveclear

12 Building Applications using ASP.NET and C# / Session 14 / 12 of 18 Sub-tags of Compilation tag - 2 <compilation debug="true" defaultLanguage=”C#”/>

13 Building Applications using ASP.NET and C# / Session 14 / 13 of 18 customErrors Setting <customErrors defaultRedirect="url" mode="On|Off|RemoteOnly"> <customErrors defaultRedirect="http://localhost/allError.aspx" mode="RemoteOnly"> <error statusCode="404" redirect=“http://localhost/Error404.aspx"/>

14 Building Applications using ASP.NET and C# / Session 14 / 14 of 18 Authentication and Authorization -1 <forms name="name" loginUrl="url" protection="All|None|Encryption " timeout="xx" path="/" >

15 Building Applications using ASP.NET and C# / Session 14 / 15 of 18 Authentication and Authorization - 2 Authentication TypeDescription Windows authentication as default authentication mode. Used for any form of IIS authentication ASP.NET forms-based authentication as default authentication mode Microsoft Passport authentication as default authentication mode No authentication. Used by anonymous users and applications providing own authentication

16 Building Applications using ASP.NET and C# / Session 14 / 16 of 18 Attributes of tag AttributeOptionDescription NameNoneCookie name used for authentication LoginUrlNoneLogin page URL. The client is redirected to this URL if no authentication cookie protectionALLApplication uses both data validation and encryption to protect the cookie. NoneBoth encryption and validation are disabled timeoutThe amount of time, in minutes, after which the authentication cookie expires. Default value is 30. pathPath for cookies issued by the application. Default value is a backslash (/)

17 Building Applications using ASP.NET and C# / Session 14 / 17 of 18 Forms Authentication <forms name="form1" loginUrl="login.aspx" protection="None" timeout="60">

18 Building Applications using ASP.NET and C# / Session 14 / 18 of 18 AuthorizationAuthorization <forms name="form1” loginUrl="login.aspx" protection="None" timeout="60">


Download ppt "Building Applications using ASP.NET and C# / Session 14 / 1 of 18 Session 14."

Similar presentations


Ads by Google