• Stars
    star
    335
  • Rank 125,904 (Top 3 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Samples from ASP.NET Web API 2: Recipes book.

ASP.NET Web API 2: Recipes

Samples from ASP.NET Web API 2: Recipes book.

Cover

Chapter 1: Web API in ASP.NET

  • 1-1 Add ASP.NET Web API to an MVC Application
  • 1-2 Add ASP.NET Web API to a Web Forms Application
  • 1-3 Accept an HTML Form
  • 1-4 Link from MVC Controller to API Controller and Vice Versa
  • 1-5 Use Scaffolding with ASP.NET Web API
  • 1-6 Add Model Validation
  • 1-7 Use CSRF Protection
  • 1-8 Add Support for Session State

Chapter 2: Web API outside of IIS

  • 2-1 Self-Host ASP.NET Web API
  • 2-2 Host ASP.NET Web API with OWIN
  • 2-3 Host ASP.NET Web API in Azure Mobile Services
  • 2-4 Quick Prototypes with scriptcs
  • 2-5 Host ASP.NET Web API in Azure Worker Role
  • 2-6 Use ASP.NET Web API with F#

Chapter 3: Routing

  • 3-1 Define Centralized Routes
  • 3-2 Define Direct Routes
  • 3-3 Set Default Route Values
  • 3-4 Set Optional Route Values
  • 3-5 Set Route Constraints
  • 3-6 Define RPC Style Routes
  • 3-7 Create Catch-all Routes
  • 3-8 Prevent Controller Methods from Inadvertently Becoming Web API Endpoints
  • 3-9 Configure Route-Specific Message Handlers
  • 3-10 Ignore Roues
  • 3-11 Localize routes
  • 3-12 Generate a Link to the Route

Chapter 4: Content Negotiation and Media Types

  • 4-1 Request a Specific Media Type from ASP.NET Web API
  • 4-2 Supporting Additional Media Types
  • 4-3 Control Model Binding From URI and Body
  • 4-4 ASP.NET MVC-style Parameter Bindingin ASP.NET Web API
  • 4-5 Customize XML and JSON Responses
  • 4-6 Write Your Own MediaTypeFormatter
  • 4-7 Run Content Negotiation Manually
  • 4-8 Bypass Content Negotiation
  • 4-9 Control Media Types with MediaTypeMappings
  • 4-10 Serve Binary Data from Web API
  • 4-11 Accept File Uploads
  • 4-12 Enable Bufferless Uploads
  • 4-13 Validate File Uploads

Chapter 5: Configuration and Customization

  • 5-1 Throttle ASP.NET Web API Calls
  • 5-2 Use Controllers from an External Assembly
  • 5-3 Use Controller-Scoped Configuration
  • 5-4 Validate Input with Action Filters
  • 5-5 OVerride Filters
  • 5-6 Add Caching to ASP.NET Web API
  • 5-7 Use an Existing Caching Library
  • 5-8 Order Filter Execution with Custom Filters
  • 5-9 Order Filter Execution Without Custom Filters
  • 5-10 Customize Error Detail Policy
  • 5-11 Return HTML from Web API
  • 5-12 Store Objects for the Duration of HTTP Request

Chapter 6: Embrace HTTP with Web API

  • 6-1 Work Directly with HttpRequestMessage
  • 6-2 Support Partial GET
  • 6-3 Support the HEAD Verb
  • 6-4 Support the PATCH Verb
  • 6-5 Support Batching of HTTP Requests
  • 6-6 Automatic HTTP 406/Not Acceptable Server Responses
  • 6-7 Implement Versioning of a Web API with Centralized Routes
  • 6-8 Implement Versioning of a Web API with Attribute Routing
  • 6-9 Use Custom HTTP Content

Chapter 7: Exceptions, Troubleshooting and Documenting

  • 7-1. Handle Exceptions with Filters
  • 7-2. Handle Exceptions Globally
  • 7-3. Log Exceptions Globally
  • 7-4. Add a Tracer
  • 7-5. Use an External Tracer
  • 7-6. Call the Tracer Manually
  • 7-7. Write a Real-time Tracer
  • 7-8. Create a Documentation Page for ASP.NET Web API
  • 7-9. Add Custom Samples to ASP.NET Web API Help Page
  • 7-10. Add Filters Information to ASP.NET Web API Help Page
  • 7-11. Support Data Annotations in ASP.NET Web API Help Page

Chapter 8: Cross Domain and Push Communictation

  • 8-1 Use JSONP in ASP.NET Web API
  • 8-2 Use CORS in ASP.NET Web API
  • 8-3 Create Custom CORS Policies
  • 8-4 Support Streaming and Push from ASP.NET Web API
  • 8-5 Support Server-Sent Events in ASP.NET Web API
  • 8-6 Integrate ASP.NET SignalR into ASP.NET Web API controllers
  • 8-7 Use WebSockets with ASP.NET Web API

Chapter 9: Dependency Injection

  • 9-1. Inject Dependencies into ASP.NET Web API Controllers
  • 9-2. Add Support for Most Popular DI Containers
  • 9-3. Deal with Request Scope
  • 9-4. DI with Other Web API Components
  • 9-5. Write a Custom DI Adapter (TinyIoC)

Chapter 10: Securing an ASP.NET Web API Service

  • 10-1 Use Correct Web API Components for Security-Related Tasks
  • 10-2 Add HTTPS Support to ASP.NET Web API
  • 10-3 Use Basic Authentication
  • 10-4 Integrate Windows Authentication
  • 10-5 Use the Hawk Authentication Scheme
  • 10-6 Use OAuth 2.0 with ASP.NET Web API (basic embedded authorization server)
  • 10-7 Safely Access Current IPrincipal
  • 10-8 Remove ASP.NET Web API Server Footprint

Chapter 11: Testing Web API Services

  • 11-1 Unit Test ASP.NET Web API Controllers
  • 11-2 Unit Test Message Handlers
  • 11-3 Unit Test Action Filters
  • 11-4 Unit Test Formatters
  • 11-5 Simplify Tests with IHttpActionResult
  • 11-6 Test Routes
  • 11-7 Integration Testing
  • 11-8 Integration Testing with OWIN

Chapter 12: OData (v4)

  • 12-1 Creating OData Services in Web API
  • 12-2 Manage OData Routes
  • 12-3 Enable OData Queries
  • 12-4 Support OData Functions and Actions

More Repositories

1

Strathweb.CacheOutput

ASP.NET Web API CacheOutput - library to allow you to cache the output of ApiControllers
C#
882
star
2

DynamicAndGenericControllersSample

C#
101
star
3

Strathweb.TypedRouting.AspNetCore

A library enabling strongly typed routing in ASP.NET Core MVC projects.
C#
75
star
4

aspnetcore-api-samples

C#
69
star
5

Strathweb.AspNetCore.AzureBlobFileProvider

C#
55
star
6

RealtimeCart

Shopping Cart sample with SignalR, Web API and Knockout.js
JavaScript
53
star
7

Strathweb.Samples.BlazorCSharpInteractive

HTML
47
star
8

Strathweb.Samples.CSharp.NoVisibilityChecks

Example of compiling and running C# code without visibility checks.
C#
46
star
9

csharp-string-to-lambda-example

C#
42
star
10

vscode-scriptcs-executor

VS Code extension for running C# snippets
TypeScript
42
star
11

net50-webapi-samples

C#
40
star
12

async-expiring-lazy

AsyncExpiringLazy
C#
37
star
13

WebApi.Html5.Upload

JavaScript
34
star
14

CollaboRoutePlanner

Demo of a collaborative route planner - SignalR, Knockout, Google Maps
JavaScript
31
star
15

html5-push-asp.net-web-api

28
star
16

Strathweb.Samples.DynamicControllerRouting

C#
25
star
17

Strathweb.Samples.AspNetCore.QueryStringBinding

C#
24
star
18

aspnetcore-parallel-pipelines

C#
20
star
19

WebApi.Service.Print

Web API self hosted inside Windows Service to provide remote access to prinitng services.
C#
19
star
20

Strathweb.Samples.Roslyn.Completion

C#
18
star
21

lightweight-aspnetcore-sample-site

C#
17
star
22

dotnet-script-aspnet

C#
17
star
23

webapi.inmemory

JavaScript
16
star
24

aspnetwebapi-wpf-p2p-chat

Build p2p chat application with WPF and ASP.NET Web API
C#
16
star
25

2018-ndcoslo-demos

C#
16
star
26

Strathweb.TypedRouting

C#
16
star
27

script-config

C#
15
star
28

Strathweb.Roslyn

Roslyn refactorings and code actions
C#
15
star
29

Strathweb.Samples.CollectibleAssemblies

C#
15
star
30

WebAPI.SignalR.Tracing

Realtime tracing for Web API
JavaScript
14
star
31

strathweb-webapi-ipfiltering

C#
13
star
32

aspnetcore-api-sample

Sample Web API built using ASP.NET Core
C#
12
star
33

wpf.dragdrop.to.webapi

C#
12
star
34

Mvc4.OpenId.Sample

A sample MVC4 project with OpenID authentication
JavaScript
11
star
35

HybridApiActionSelector

HTTP verb & action name hybrid dispatcher for Web API
C#
11
star
36

aspnetwebapi-api-usage

aspnetwebapi-api-usage
JavaScript
11
star
37

Metadata.WebApi

Adding useful metadata to your Web Api responses
JavaScript
10
star
38

Ninject-resolver-for-ASP.NET-Web-API

Ninject resolver for ASP.NET Web API
C#
9
star
39

Remote.Spotify

Remote.Spotify
JavaScript
8
star
40

Strathweb.Samples.RustFromSwift

Swift
8
star
41

Strathweb.Samples.DispatchProxy

C#
8
star
42

Glimpse.ScriptCs

Execute any code in your web app with ScriptCs and Glimpse
C#
8
star
43

strathweb-phi-engine

Rust
8
star
44

WebApi.ActionInjector

C#
7
star
45

roslyn-samples

C#
7
star
46

AspNetCore.ActionDependencyInjection.Sample

C#
6
star
47

FilterOrdering.WebAPi

JavaScript
5
star
48

Roslyn.Resolvers.Demo

C#
5
star
49

net60-webapi-samples

C#
5
star
50

aspnet5-reusable-components

C#
4
star
51

ndcoslo2015-demos

Demo of migrating Web API to MVC6 from NDC Oslo 2015
C#
4
star
52

Strathweb.Samples.ILproj

C
4
star
53

dotnet-wasi-demos

C#
4
star
54

strathweb-samples-azureopenai

C#
4
star
55

sample-native-cplus-http-service

Sample native C++ HTTP service with Casablanca
C++
4
star
56

Strathweb.RouteConventions.AspNetCore

C#
4
star
57

intro-to-qc-with-qsharp-book

Source code for the "Introduction to Quantum Computing with Q# and QDK" book
Q#
4
star
58

2024-zurich-azure-ug-demos

C#
4
star
59

Strathweb.Samples.RustFromCSharp

Rust
4
star
60

dnx-scriptcs-repl

C#
3
star
61

Strathweb.Dilithium

C#
3
star
62

Strathweb.Samples.DotnetWasi

C
3
star
63

2020-swetugg-demos

C#
3
star
64

AspNetCore.ControllersAsFilters.Sample

C#
3
star
65

csharp-scripting-demos

JavaScript
3
star
66

ScriptCs.WebConsole

JavaScript
3
star
67

update-conf-2018-demos

JavaScript
3
star
68

climax-web-http

A set of add-ons and extensions for ASP.NET Web API.
C#
2
star
69

scriptcs-python

C#
2
star
70

RemoveRegionAnalyzerAndCodeFix

C#
2
star
71

Strathweb.CacheOutput.Azure

Strathweb.CacheOutput.Azure
C#
2
star
72

2019-ndcporto-demos

C#
2
star
73

dotnetconf-2018-demos

C#
2
star
74

sample-scriptcs-webhost

C#
2
star
75

QSharp.Demos

Q#
2
star
76

filipw.github.io

JavaScript
2
star
77

Roslyn.WebApi.IssueExample

Example of implementing Roslyn code issue/action for Web API
C#
2
star
78

ScriptCs.AzureMobileServices

C#
2
star
79

2023-dotnetday-demos

Q#
1
star
80

scriptcs-dnx

C#
1
star
81

2023-ndcoslo-demos

Q#
1
star
82

ScriptCs.HttpLineProcessor

C#
1
star
83

ScriptCs.SsRedis

scriptcs script pack for ServiceStack.Redis
C#
1
star
84

Strathweb.Samples.ServiceBus.ReactiveMessageHandling

1
star
85

Strathweb.Samples.CSharp.Crystals

C#
1
star
86

Strathweb.ScriptConfiguration

C#
1
star
87

Strathweb.Samples.Duende.Dilithium

C#
1
star
88

ndc-sydney2016-demos

C#
1
star
89

2021-geneva-net-ug-demos

Q#
1
star
90

2021-zurich-net-ug-demos

Q#
1
star
91

Sharing

1
star
92

2019-switzerland-netday-demos

C#
1
star
93

2019-dotnetcologne-demos

JavaScript
1
star
94

ScriptCs.Engine.Brainfuck

C#
1
star
95

ndc-sydney-2017-demos

JavaScript
1
star
96

Strathweb.Samples.ServiceBus.TaskScheduling

1
star
97

Strathweb.Samples.NoConstructor

C#
1
star
98

Strathweb.Samples.Roslyn.Classification

C#
1
star
99

dotnext-spb2017-demos

Demos from my Roslyn talk at DotNext St. Petersburg 2017
C#
1
star
100

Strathweb.Samples.RuntimeHostConfigurationOptions

C#
1
star