1 / 19

Ahmed_Moosa83@yahoo

Web .Config. Ahmed_Moosa83@yahoo.com. Ahmed Moosa ASP.Net Instructor. Download Slides. www.Ahmedmoosa.wordpress.com. Web .Config. Web .config in Xml File . IntelliSense Make It Better Can Configure All Web Site Pages There are Two File Machine .config Web. Config

kane-dale
Download Presentation

Ahmed_Moosa83@yahoo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web .Config Ahmed_Moosa83@yahoo.com Ahmed Moosa ASP.Net Instructor

  2. Download Slides www.Ahmedmoosa.wordpress.com

  3. Web .Config • Web .config in Xml File . • IntelliSense Make It Better • Can Configure All Web Site Pages • There are Two File • Machine .config • Web. Config • Can Find Them : (C:\WINDOWS\Microsoft.NET\Framework\[version]\CONFIG ) • Have Default Setting also in • web.config.default • Machine.config.default

  4. Must • Enter All Settings Between • <Configuration > …. </Configuration > • Case Sensitive Declaration • camelCase All Properties • Define Namespaces When Programmatically • System .Configuration • System.Web.Configuration • Define Your Setting Between it’s Category • <System. Web >……</System. Web> • <System. Net >…….</System. Net >

  5. Some Elements • configure Page directive Setting s : • <pages> • Configure Connection String : • <connectionStrings > • Configure Application Setting s: • <appSettings> • Configure Error Pages : • <customError> • Configure Membership • <membership>

  6. Elements in Some Details

  7. <Pages> • You Can Set • a lot Of Properties For Example <pages masterPageFile ="MyMasterPage.master“ theme="myTheme“ > </pages> • Set Namespace <pages > <namespaces > <add namespace="System.Data.SqlClient"/> </namespaces> </pages> • Add Controls Like Ajax Controls <controls >….<controls>

  8. <Location> • <Pages> ..</Pages> To All Pages • <Location>…</Location> as You Specify • Page - Folder - Subfolder (as you Like ) . • Example:- Set Master Page To Admin Folder only <location path ="Admin"> <system.web> <pages masterPageFile="AdminMasterPage.master" /> </system.web> </location>

  9. <customError> • Can Show friendly Error • Set Default Redirect Page URL • Show Page by Error Code • Like this : <system.web> <customErrors mode ="On" defaultRedirect ="defaultErrorPage.aspx" > <error statusCode ="404" redirect ="NotFound.aspx"/> <error statusCode ="500" redirect ="CallSupport.aspx"/> <error statusCode ="403" redirect ="Forbidden.aspx"/> </customErrors> </system.web> • There are A lot Of Details about Will be in My Blog .

  10. <Globalization> • Set Multilanguage Site • Working With Resource File (resource.resx ) • UiCulture (User interface ) Will Change • Like This : <system.web> <globalization culture ="auto:ar-eg" uiCulture ="auto" /> </system.web> • Above I set Default Culture To Arabic Egypt • User Interface Will Change as I set In My Internet Option Explorer Sequentially .

  11. <trace> • It ‘s a page I Call It Manually in Address Bar • comes With Extension .axd ( trace.axd ) • Show Number of request That Users Call • Can Follow all Request in Web Site By Details • Like This :- <system.web> <trace enabled="true" traceMode="SortByTime" mostRecent="true" requestLimit="10" pageOutput="false" localOnly ="true" /> </system.web>

  12. Trace Page http://localhost:8080//MyWebsite/trace.xd

  13. <ConnectionStrings> • Define Data Source , Server and Security • In My Visual Web Developer Express Edition It‘s Like This : <connectionStrings> <add name="MyConnectionString“ connectionString ="Data Source =.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\MyDataBaseFile.mdf; Integrated Security=True;User Instance=True"/> </connectionStrings> • It Is Simple ( Set and Forget ) • Call it any Page You Want .

  14. <appSetttings> • Define Global Variable using Key and Value. Example: <appSettings> <add key ="MyVariable" value ="SomeValue"/> </appSettings> • Also Can define more than one variable . - Note :Can Store Connection Strings

  15. <mailSettings> • Set Mail Settings (Host info – sender info-…) • Mail Settings is under System.Net Category • Like :- <system.net> <mailSettings> <smtp from="admin@mysite.com" > <network host="smtp.mysite.com" userName ="admin" password =“*********" /> </smtp> </mailSettings> </system.net>

  16. <httpRuntime> • Set Http Runtime Settings • Use it When Upload Large Files <system.web> <httpRuntime maxRequestLength ="1048576" executionTimeout ="3600" /> </system.web> • Note: • maxRequestLength in Kb • executionTimeout in second

  17. < Compilation> • Web Site Compilation Settings And Debug • Set Debug To true When Debugging . • Better To Set Debug To False When Deployment • Decrease Memory Size • Fasts Performance <system.net> <compilation debug="true" /> </system.net>

  18. < Authentication> • define identity (Just User Or Member ) • ASP.Net Provide Default Database Call it (aspnet.mdf) • Generate Database Automatically by using ASP.Net Configuration From Website Menu <system.web> <authentication mode="forms" /> <system.web> Will be more in My Blog About this Later

  19. <authorization> • Define License To Members in access Rules • Can give License to Group by using Role • Allow Access Pages And deny Others

More Related