SlideShare a Scribd company logo
WHAT 
NOT TO DO 
WITH ASPNET 
Common mistakes to avoid while using 
aspnet for web projects
I .STANDARDS COMPLIANCE 
No Control adapters : 
It's best to use solid adaptive CSS and HTML techniques.
I. STANDARDS COMPLIANCE 
No style values in the control markup: 
Set CSS classes yourself, don't use inline styles. protected void CustomersGridView_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
if (e.Row.Cells[2].Text == "Unconfirmed") 
{ 
e.Row.CssClass = "CautionRow"; 
} 
}
I. STANDARDS COMPLIANCE 
No page and control callbacks: 
Stick with SignalR, Web API, and JavaScript.
I. STANDARDS COMPLIANCE 
No static browser capability detection: 
Check for features instead of browsers
II. SECURITY 
No Request Validation: 
Validate user input and encode values from users.
II. SECURITY 
No Cookieless Forms Authentication and Session 
Require cookies when application includes authentication. 
<authentication mode="Forms"> 
<forms loginUrl="member_login.aspx“ 
cookieless="UseCookies" 
requireSSL="true" 
path="/MyApplication" /> 
</authentication>
II. SECURITY 
Do not set EnableViewStateMac to false. 
Require cookies when application includes authentication. 
<%@ Page language="C#" EnableViewStateMac="true" %>
II. SECURITY 
Do not depend on Medium Trust: 
Keep Apps in separate App pools.
II. SECURITY 
Do not disable security patches with appsettings: 
Keep Apps in separate App pools.
II. SECURITY 
Do not use UrlPathEncode: 
Use UrlEncode Instead. 
string destinationURL = "http://www.contoso.com/default.aspx?user=test"; 
NextPage.NavigateUrl = "~/Finish?url=" + Server.UrlEncode(destinationURL);
III. RELIABILITY AND PERFORMANCE 
No PreSendRequestHeaders and PreSendRequestContext: 
Use native IIS module to perform the required task
III. RELIABILITY AND PERFORMANCE 
No Asynchronous Page Events with Web Forms: 
Use Page.RegisterAsyncTask instead 
protected void StartAsync_Click(object sender, EventArgs e) { 
Page.RegisterAsyncTask(new PageAsyncTask(async() => { string 
stringToRead = "Long text value"; using (StringReader reader = new 
StringReader(stringToRead)) { string readText = await 
reader.ReadToEndAsync(); Result.Text = readText; } })); }
III. RELIABILITY AND PERFORMANCE 
No Fire-and-Forget Work: 
Move ThreadPool.QueueUserWorkItem outside or use WebBackgrounder if 
you must
III. RELIABILITY AND PERFORMANCE 
No reading Request.Form or Request.InputStream before the 
handler's execute event: 
Stay out of Request.Form and Request.InputStream before your handler's 
execute event. It may not be ready to go
III. RELIABILITY AND PERFORMANCE 
No Long-running Requests (>110 seconds): 
Use WebSockets or SignalR for connected clients, and use asynchronous 
I/O operations
THANK YOU ! 
WWW.PSIBERTECH.COM.SG

More Related Content

PPTX
SgCodeJam24 Workshop Extract
PDF
Open social for science a sciverse primer - mysimplesearch
PDF
Softlayer_API_openWhisk
PPTX
07.1. Android Even Handling
PPTX
Lidiia 'Alice' Skalytska - Security Checklist for Web Developers
PDF
Resume (2)
PPTX
Angular js 1.x - Main Concepts presented in FronteersJo Meetup
PPTX
Authorization and Authentication using IdentityServer4
SgCodeJam24 Workshop Extract
Open social for science a sciverse primer - mysimplesearch
Softlayer_API_openWhisk
07.1. Android Even Handling
Lidiia 'Alice' Skalytska - Security Checklist for Web Developers
Resume (2)
Angular js 1.x - Main Concepts presented in FronteersJo Meetup
Authorization and Authentication using IdentityServer4

What's hot (20)

PPTX
Python in SQL 2019
PDF
Bleeding edge web stuff
PPTX
Azure - Il cloud secondo microsoft
PPTX
Offline Storage
PDF
Syed Ubaid Ali Jafri - Secure IIS Configuration Windows 7
PPTX
View controllers en iOS
PPTX
11.1 Android with HTML
PPTX
Progressive Web Apps - Tips
PPTX
Securing the Web@VoxxedDays2017
PPTX
Asp.net page lifecycle
PPTX
Microsoft asp.net identity security
PPT
Spring Security Introduction
PPTX
New microsoft office power point presentation
PPT
Ajax Security
PDF
AJAX Security - LAC2016
PDF
Spring Cloud Gateway - Nate Schutta
PPTX
Spring security
PDF
Spring security jwt tutorial toptal
PPTX
OAuth
PPTX
ZZ BC#8 Hello ASP.NET MVC 4 (dks)
Python in SQL 2019
Bleeding edge web stuff
Azure - Il cloud secondo microsoft
Offline Storage
Syed Ubaid Ali Jafri - Secure IIS Configuration Windows 7
View controllers en iOS
11.1 Android with HTML
Progressive Web Apps - Tips
Securing the Web@VoxxedDays2017
Asp.net page lifecycle
Microsoft asp.net identity security
Spring Security Introduction
New microsoft office power point presentation
Ajax Security
AJAX Security - LAC2016
Spring Cloud Gateway - Nate Schutta
Spring security
Spring security jwt tutorial toptal
OAuth
ZZ BC#8 Hello ASP.NET MVC 4 (dks)
Ad

Similar to What not to do with ASP NET (20)

PPT
IEEE KUET SPAC presentation
PDF
Tips and Tricks For Faster Asp.NET and MVC Applications
DOCX
High performance coding practices code project
PPTX
Scaling asp.net websites to millions of users
PPTX
10 tips to make your ASP.NET Apps Faster
PDF
How to optimize asp dot-net application
PPTX
10 performance and scalability secrets of ASP.NET websites
PDF
Asp.Net Tips
PPTX
ASP.NET Quick Wins - 20 Tips and Tricks To Shift Your Application into High Gear
PDF
Professional Aspnet 20 Security Membership And Role Management Stefan Schackow
PPTX
Asp.net performance
PDF
10 things I’ve learnt about web application security
PDF
10 things to remember
PDF
ASP.NET Scalability - DDD7
PPT
How To Optimize Asp.Net Application ?
PPT
How to optimize asp dot net application ?
PPTX
Mobile Devices and SharePoint - Sahil Malik
PPTX
Mobile devices and SharePoint
PDF
ASP.NET Scalability - NxtGen Oxford
PPTX
Asynchronous programming in ASP.NET
IEEE KUET SPAC presentation
Tips and Tricks For Faster Asp.NET and MVC Applications
High performance coding practices code project
Scaling asp.net websites to millions of users
10 tips to make your ASP.NET Apps Faster
How to optimize asp dot-net application
10 performance and scalability secrets of ASP.NET websites
Asp.Net Tips
ASP.NET Quick Wins - 20 Tips and Tricks To Shift Your Application into High Gear
Professional Aspnet 20 Security Membership And Role Management Stefan Schackow
Asp.net performance
10 things I’ve learnt about web application security
10 things to remember
ASP.NET Scalability - DDD7
How To Optimize Asp.Net Application ?
How to optimize asp dot net application ?
Mobile Devices and SharePoint - Sahil Malik
Mobile devices and SharePoint
ASP.NET Scalability - NxtGen Oxford
Asynchronous programming in ASP.NET
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
KodekX | Application Modernization Development
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KodekX | Application Modernization Development
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx

What not to do with ASP NET

  • 1. WHAT NOT TO DO WITH ASPNET Common mistakes to avoid while using aspnet for web projects
  • 2. I .STANDARDS COMPLIANCE No Control adapters : It's best to use solid adaptive CSS and HTML techniques.
  • 3. I. STANDARDS COMPLIANCE No style values in the control markup: Set CSS classes yourself, don't use inline styles. protected void CustomersGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.Cells[2].Text == "Unconfirmed") { e.Row.CssClass = "CautionRow"; } }
  • 4. I. STANDARDS COMPLIANCE No page and control callbacks: Stick with SignalR, Web API, and JavaScript.
  • 5. I. STANDARDS COMPLIANCE No static browser capability detection: Check for features instead of browsers
  • 6. II. SECURITY No Request Validation: Validate user input and encode values from users.
  • 7. II. SECURITY No Cookieless Forms Authentication and Session Require cookies when application includes authentication. <authentication mode="Forms"> <forms loginUrl="member_login.aspx“ cookieless="UseCookies" requireSSL="true" path="/MyApplication" /> </authentication>
  • 8. II. SECURITY Do not set EnableViewStateMac to false. Require cookies when application includes authentication. <%@ Page language="C#" EnableViewStateMac="true" %>
  • 9. II. SECURITY Do not depend on Medium Trust: Keep Apps in separate App pools.
  • 10. II. SECURITY Do not disable security patches with appsettings: Keep Apps in separate App pools.
  • 11. II. SECURITY Do not use UrlPathEncode: Use UrlEncode Instead. string destinationURL = "http://www.contoso.com/default.aspx?user=test"; NextPage.NavigateUrl = "~/Finish?url=" + Server.UrlEncode(destinationURL);
  • 12. III. RELIABILITY AND PERFORMANCE No PreSendRequestHeaders and PreSendRequestContext: Use native IIS module to perform the required task
  • 13. III. RELIABILITY AND PERFORMANCE No Asynchronous Page Events with Web Forms: Use Page.RegisterAsyncTask instead protected void StartAsync_Click(object sender, EventArgs e) { Page.RegisterAsyncTask(new PageAsyncTask(async() => { string stringToRead = "Long text value"; using (StringReader reader = new StringReader(stringToRead)) { string readText = await reader.ReadToEndAsync(); Result.Text = readText; } })); }
  • 14. III. RELIABILITY AND PERFORMANCE No Fire-and-Forget Work: Move ThreadPool.QueueUserWorkItem outside or use WebBackgrounder if you must
  • 15. III. RELIABILITY AND PERFORMANCE No reading Request.Form or Request.InputStream before the handler's execute event: Stay out of Request.Form and Request.InputStream before your handler's execute event. It may not be ready to go
  • 16. III. RELIABILITY AND PERFORMANCE No Long-running Requests (>110 seconds): Use WebSockets or SignalR for connected clients, and use asynchronous I/O operations
  • 17. THANK YOU ! WWW.PSIBERTECH.COM.SG