{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Docs/issues/985","repository_url":"https://api.github.com/repos/aspnet/Docs","labels_url":"https://api.github.com/repos/aspnet/Docs/issues/985/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Docs/issues/985/comments","events_url":"https://api.github.com/repos/aspnet/Docs/issues/985/events","html_url":"https://github.com/aspnet/Docs/issues/985","id":133136764,"number":985,"title":"Update Middleware","user":{"login":"Rick-Anderson","id":3605364,"avatar_url":"https://avatars.githubusercontent.com/u/3605364?v=3","gravatar_id":"","url":"https://api.github.com/users/Rick-Anderson","html_url":"https://github.com/Rick-Anderson","followers_url":"https://api.github.com/users/Rick-Anderson/followers","following_url":"https://api.github.com/users/Rick-Anderson/following{/other_user}","gists_url":"https://api.github.com/users/Rick-Anderson/gists{/gist_id}","starred_url":"https://api.github.com/users/Rick-Anderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rick-Anderson/subscriptions","organizations_url":"https://api.github.com/users/Rick-Anderson/orgs","repos_url":"https://api.github.com/users/Rick-Anderson/repos","events_url":"https://api.github.com/users/Rick-Anderson/events{/privacy}","received_events_url":"https://api.github.com/users/Rick-Anderson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/Docs/labels/0%20-%20Backlog","name":"0 - Backlog","color":"CCCCCC"},{"url":"https://api.github.com/repos/aspnet/Docs/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/aspnet/Docs/labels/P0","name":"P0","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/aspnet/Docs/milestones/5","html_url":"https://github.com/aspnet/Docs/milestones/1.0.0-rc2","labels_url":"https://api.github.com/repos/aspnet/Docs/milestones/5/labels","id":1443065,"number":5,"title":"1.0.0-rc2","description":"","creator":{"login":"danroth27","id":1874516,"avatar_url":"https://avatars.githubusercontent.com/u/1874516?v=3","gravatar_id":"","url":"https://api.github.com/users/danroth27","html_url":"https://github.com/danroth27","followers_url":"https://api.github.com/users/danroth27/followers","following_url":"https://api.github.com/users/danroth27/following{/other_user}","gists_url":"https://api.github.com/users/danroth27/gists{/gist_id}","starred_url":"https://api.github.com/users/danroth27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danroth27/subscriptions","organizations_url":"https://api.github.com/users/danroth27/orgs","repos_url":"https://api.github.com/users/danroth27/repos","events_url":"https://api.github.com/users/danroth27/events{/privacy}","received_events_url":"https://api.github.com/users/danroth27/received_events","type":"User","site_admin":false},"open_issues":96,"closed_issues":89,"state":"open","created_at":"2015-12-03T22:04:46Z","updated_at":"2016-04-22T21:13:07Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2016-02-12T01:38:53Z","updated_at":"2016-04-24T15:10:23Z","closed_at":null,"body":"- [ ] Update topic\r\n- [ ] Edit pass\r\n- [ ] update static files will not be protected by any authentication\r\n- [ ] Add link to Migrating HTTP Modules to Middleware\r\n\r\nRewrite as\r\nMiddleware are software components that are assembled into an application pipeline to handle requests and responses. Each component chooses whether to pass the request on to the next component in the pipeline, and can perform certain actions before and after the next component is invoked in the pipeline. Request delegates are used to build the request pipeline. The request delegates handle each HTTP request.\r\n\r\n Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline, or short-circuiting the chain if appropriate.\r\n\r\n<!---\r\n@huboard:{\"order\":2.4234771727628868}\r\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Docs/issues/comments/213981325","html_url":"https://github.com/aspnet/Docs/issues/985#issuecomment-213981325","issue_url":"https://api.github.com/repos/aspnet/Docs/issues/985","id":213981325,"user":{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars.githubusercontent.com/u/1821173?v=3","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T15:10:23Z","updated_at":"2016-04-24T15:10:23Z","body":"Sounds pretty good. I've included one line from your other description:\r\n\r\n\"The order in which you add middleware components is generally the order in which they take effect. This can be critical to your app’s security, performance and functionality. For example, adding exception handling after any other middleware components will miss exceptions thrown by those components. In the code above, the static file module is called early in the pipeline so it can handle requests and short circuit without going through unnecessary stages of the pipeline. The authentication middleware is added to the pipeline before any module that handles requests that need to be authenticated.\"\r\n\r\nHow do we capture that the pipeline terminates at a certain point and then executes in reverse on the response? This is one of the most common misunderstandings around the positioning of the exception handling middleware. People think it needs to be after the component that causes the exception, not before it. How's this?\r\n\r\n\"The order in which you add middleware components is generally the order in which they take effect on the request, and then in reverse for the response. This can be critical to your app’s security, performance and functionality. In the code above, the static file middleware is called early in the pipeline so it can handle requests and short circuit without going through unnecessary components. The authentication middleware is added to the pipeline before anything that handles requests that need to be authenticated. Exception handling must be registered before other middleware components in order to catch exceptions thrown by those components.\""}}