httpcontext

HttpContext.Current.Request.Form.AllKeys in ASP.NET CORE version

廉价感情. 提交于 2020-12-05 06:38:57
问题 foreach (string key in HttpContext.Current.Request.Form.AllKeys) { string value = HttpContext.Current.Request.Form[key]; } What is the .net core version of the above code? Seems like .net core took out AllKeys and replaced it with Keys instead. I tried to convert the above code to the .net core way, but it throws an invalid operation exception. HttpContext.Request.Form = 'HttpContext.Request.Form' threw an exception of type 'System.InvalidOperationException' Converted code: foreach (string

Azure App Service terminating https before application?

£可爱£侵袭症+ 提交于 2020-08-19 05:42:52
问题 I'm building an asp.net core web application on framework 2.2 and hosting on an azure app service on a linux app service plan. Inside my application I inspect HttpRequest.Scheme. Running locally this returns https if I make a request using https. Running on azure it returns http . It appears Azure App Services is terminating the SSL connection and proxying to my app. Is there a way to configure Azure App Services so the https request makes it to my application unmodified? Or at least

In a blazor app, is it possible to get the requested path, if the render mode is set to “server”?

陌路散爱 提交于 2020-08-11 01:56:22
问题 I created a Blazor client app and and within this app I have a number of authorization policies with custom requirements and handlers. One of them checks the ID requested in the URL and checks whether the logged in user can view this resource. For example, through the client, the user navigates to https://localhost/resource/1f28e41c-bc75-44d6-9eef-d46b66b649c7 which is a resource on my API. I’m using the following code to see the request path: var httpContext = _httpContextAccessor

In a blazor app, is it possible to get the requested path, if the render mode is set to “server”?

北战南征 提交于 2020-08-11 01:55:48
问题 I created a Blazor client app and and within this app I have a number of authorization policies with custom requirements and handlers. One of them checks the ID requested in the URL and checks whether the logged in user can view this resource. For example, through the client, the user navigates to https://localhost/resource/1f28e41c-bc75-44d6-9eef-d46b66b649c7 which is a resource on my API. I’m using the following code to see the request path: var httpContext = _httpContextAccessor

In a blazor app, is it possible to get the requested path, if the render mode is set to “server”?

巧了我就是萌 提交于 2020-08-11 01:55:30
问题 I created a Blazor client app and and within this app I have a number of authorization policies with custom requirements and handlers. One of them checks the ID requested in the URL and checks whether the logged in user can view this resource. For example, through the client, the user navigates to https://localhost/resource/1f28e41c-bc75-44d6-9eef-d46b66b649c7 which is a resource on my API. I’m using the following code to see the request path: var httpContext = _httpContextAccessor

Add HttpContext into HangFire

耗尽温柔 提交于 2020-08-04 06:03:21
问题 I am a beginner with HangFire and looking forward to using HangFire to call some actions in my web application monthly. But these actions require HttpContext. Then my question is: Is there any way to add (or create) a httpcontext in HangFire project? I tried to google but no suitable answer. Thanks for your help! I found a short discussion. Sad to see the answer is "no way". Update: Ref https://discuss.hangfire.io/t/passing-site-url-to-hangfire-recurrent-jobs/2641 回答1: I have a similar

custom asp.net identity store - why is HttpContext.Current empty at times

心已入冬 提交于 2020-01-24 12:05:29
问题 I've implemented a custom User Store for ASP.NET Identity by following the example set here. That all works fine, except for this: I need access to data about the currently logged in user in my user store. Normally, you'd access that by accessing HttpContext.Current.User Now, once auser has logged in, if he user then goes to the Manage controller (e.g. to try and change his/her password), when ASP.NET identity looks up the user again by calling CustomUserManager.FindByIdAsync(string userId)

custom asp.net identity store - why is HttpContext.Current empty at times

北城以北 提交于 2020-01-24 12:05:16
问题 I've implemented a custom User Store for ASP.NET Identity by following the example set here. That all works fine, except for this: I need access to data about the currently logged in user in my user store. Normally, you'd access that by accessing HttpContext.Current.User Now, once auser has logged in, if he user then goes to the Manage controller (e.g. to try and change his/her password), when ASP.NET identity looks up the user again by calling CustomUserManager.FindByIdAsync(string userId)