
Leverage the CIA triad—confidentiality, integrity, and availability—to guide secure code in C# and .NET, ensuring authorized access, unaltered data, and dependable data availability.
Explore common security mistakes in secure code, from hard-coded secrets and insecure configuration on GitHub to unvalidated input, unhandled exceptions, poor logging, and careless copy-paste with encryption APIs.
Explore common vulnerabilities and how insecure code leads to breaches, and learn to think like an attacker while coding like a defender in .NET.
Install .NET 10 SDK, configure Visual Studio/VS Code, enable Copilot, and set up your first secure project template.
Learn the stages of secure development and where security fits into design, implementation, and deployment.
Introduction to STRIDE methodology and how to identify threats early.
Explore .NET authentication patterns across web apps, APIs, and SPAs—cookie-based auth with anti-forgery tokens and jwt via OAuth 2.1, plus Open ID Connect and Entra ID for single sign-on.
Implement secure user registration, login, and logout.
Implement a secure web app login with identity pages, anti-forgery protection, and post-based submission. Enforce local redirects and rely on the sign-in manager and cookies to prevent phishing.
Enable MFA via email or authenticator app in an existing .NET app.
Implement refresh tokens, token expiry, and revocation policies.
Explore implementing user lockout in identity by configuring max failed attempts and lockout duration, enforcing lockout on login attempts, and handling redirect to a lockout page.
Apply authorization to APIs and web pages by using the authorize attribute on controllers or actions, optionally allow anonymous for select endpoints, and understand 401 responses and login redirects.
Bridge security and legal compliance in modern .NET applications by implementing encryption with .NET cryptography libraries, secure logging and auditing, and data retention and deletion policies across industries and regions.
Secure data in transit with TLS and in rest with encryption, while controls, logging, and safe storage in .NET apps defend against breaches and PII leaks.
Explore cryptography fundamentals in .NET, including SHA-256 hashing, AES and RSA encryption, the data protection API, key management, and best practices for secure authentication and data protection.
Audit a sample EF Core project to identify PII. Tag properties with a sensitive attribute and data classification, and plan encryption and PCI DSS controls for card data.
Create a sensitive data masking helper in C# to mask national IDs and other values, returning only the last four digits, and integrate it when displaying customer details.
Implement secure audit logging by hashing sensitive data in a dedicated auditing detail module, then serialize as JSON and persist tamper-proof records via an iAuditLogger.
Build tamper-proof audit logs by chaining each record’s hash to the previous, compute hashes, and verify integrity to detect tampering.
Understand how SQL injection works and why it's a design failure. Learn to defend by always parameterizing queries, using Entity Framework Core, and encoding outputs to prevent data breaches.
Expose how unparameterized raw SQL in the intakes search endpoint enables SQL injection via query strings, illustrate attack patterns, and outline parameterization and mitigations to prevent data loss.
Develop security-first ci/cd pipelines for .NET apps with GitHub Actions, secure repository configurations, and software composition analysis to detect vulnerabilities and deploy hardened container images.
Embed security into ci/cd deployments by treating pipelines as security boundaries while applying threat modeling to prevent compromised pull requests, dependencies, and runners.
Set up a GitHub repository for secure CI/CD by configuring a new repo, setting the default branch to main, and enforcing pull requests with protection rules.
Software composition analysis automatically scans your app for third-party components, detects CVEs and license issues, and flags transitive dependencies in CI/CD to enforce secure, up-to-date packages.
Set up a software composition analysis gate with GitHub Actions to block direct main pushes, review dependencies, and enforce secure NuGet packages in pull requests.
Configure dependabot in the .github workflows to run weekly, create PRs with security updates, enforce minimal read permissions, perform dependency reviews, and add license governance for OWASP alignment.
Secure Coding in C# and .NET: Build Safer Applications with OWASP, ASP.NET Core Security, DevSecOps, and AI-Assisted Development
Modern developers cannot afford to treat security as an afterthought. Whether you are building ASP.NET Core APIs, web applications, microservices, or cloud-hosted .NET systems, you need to understand how vulnerabilities happen, how attackers exploit weak code, and how to prevent common security mistakes before they reach production.
In this hands-on course, you will learn how to write secure C# and .NET code using practical techniques based on real application security risks, OWASP guidance, and modern developer workflows. You will work through secure coding practices for authentication, authorization, input validation, data protection, secret management, dependency security, logging, CI/CD pipelines, and AI-assisted development with GitHub Copilot.
This course is designed for C# and .NET developers who want to go beyond making applications work. You will learn how to make them safer, more resilient, and better prepared for real-world security expectations.
What makes this course different?
Most application security courses are broad and language-agnostic. This course focuses on the Microsoft .NET ecosystem. You will see how secure coding concepts apply directly to C#, ASP.NET Core, Entity Framework Core, Identity, JWT, OAuth, OpenID Connect, Azure Key Vault, GitHub Actions, Azure DevOps, Docker, and GitHub Copilot.
You will also learn how AI-generated code can introduce security risks and how to use tools like GitHub Copilot more responsibly during development and review.
What you will learn
You will learn how to:
Apply secure coding principles in C# and .NET applications
Understand OWASP Top 10 risks from a .NET developer’s perspective
Secure ASP.NET Core APIs and web applications
Implement safer authentication and authorization flows
Protect applications from broken access control and privilege escalation
Validate and sanitize user input to reduce injection and XSS risks
Protect sensitive data using encryption, hashing, TLS, and secure storage
Manage secrets safely in local development, GitHub, Azure, and CI/CD workflows
Avoid common security mistakes in configuration and deployment
Use dependency scanning and static analysis to detect vulnerabilities
Review and harden AI-generated code from GitHub Copilot
Build security into the software development lifecycle
Secure authentication and authorization
Authentication and authorization are two of the most common sources of serious application security failures. In this course, you will examine how to protect login flows, tokens, claims, roles, policies, and access rules in ASP.NET Core applications.
You will explore .NET Identity, JWT, OAuth, OpenID Connect, MFA concepts, role-based authorization, claims-based authorization, and practical ways to reduce broken access control vulnerabilities.
Input validation, injection prevention, and safer APIs
You will learn how insecure input handling can lead to SQL injection, command injection, cross-site scripting, insecure deserialization, excessive data exposure, and unsafe business logic. You will use .NET validation tools, custom validators, allowlists, model validation, secure patterns, and practical coding techniques to reduce these risks.
Secret management and data protection
You will learn how to prevent the leakage of credentials, keys, tokens, and connection strings. You will examine safer approaches using local user secrets, environment variables, GitHub secrets, Azure Key Vault, secure configuration practices, and least-privilege access.
You will also learn how to protect sensitive data at rest and in transit using .NET cryptography APIs, hashing, encryption, TLS, and secure logging practices that avoid exposing personally identifiable information.
Secure build and deployment workflows.
Security does not stop when the code compiles. You will learn how to strengthen your build and deployment process using GitHub Actions, Azure DevOps, Docker, dependency vulnerability checks, static code analysis, and secure CI/CD practices.
You will also examine common supply chain security risks and how to reduce exposure in modern .NET development workflows.
Secure AI-assisted development with GitHub Copilot
AI tools can help developers move faster, but faster code is not automatically safer code. This course shows you how to use GitHub Copilot and AI-assisted workflows with a security mindset.
You will learn how to review AI-generated code, identify risky suggestions, ask better security-focused prompts, and use Copilot to help find, explain, and fix vulnerabilities in C# and .NET applications.
Tools and technologies covered
C# and .NET
ASP.NET Core
ASP.NET Core Identity
Entity Framework Core
JWT, OAuth, OpenID Connect, MFA concepts
OWASP Top 10
Azure Key Vault
GitHub Copilot
GitHub Actions
Azure DevOps
Docker
Security Code Scan
OWASP Dependency Check
Secure configuration and secret management
Who this course is for
This course is for:
C# developers who want to write more secure applications
ASP.NET Core developers building APIs, MVC, Razor Pages, or Blazor applications
Backend developers responsible for authentication, authorization, and sensitive data
Software engineers preparing for secure coding expectations in professional teams
DevOps and cloud engineers supporting secure .NET deployments
Students and career changers who want secure coding knowledge as part of their developer portfolio
Architects and team leads who want practical security awareness across the .NET SDLC
Prerequisites
You should have basic experience writing C# code and running .NET applications. You do not need to be a cybersecurity expert. This course is designed to help developers build practical application security skills using familiar .NET tools and workflows.
By the end of the course
By the end of this course, you will understand how common vulnerabilities appear in C# and .NET applications, how to fix them, and how to build safer development habits into your everyday coding workflow. You will be better prepared to develop secure APIs, protect sensitive data, manage secrets, review AI-generated code, and contribute to more secure software delivery.