asp.net-4.5

HttpRuntime.Cache Equivalent for asp.net 5, MVC 6

核能气质少年 提交于 2019-11-29 15:34:14
So I've just moved from ASP.Net 4 to ASP.Net 5. Im at the moment trying to change a project so that it works in the new ASP.Net but of course there is going to be a load of errors. Does anyone know what the equivalent extension is for HttpRuntime as I cant seem to find it anywhere. I'm using to cache an object client side. HttpRuntime.Cache[Findqs.QuestionSetName] 'Findqs' is just a general object You can an IMemoryCache implementation for caching data. There are different implementations of this including an in-memory cache, redis,sql server caching etc.. Quick and simple implemenation goes

How create a MultipartFormFormatter for ASP.NET 4.5 Web API

↘锁芯ラ 提交于 2019-11-29 12:44:20
These links didn't help me: Way 1 Way 2 Example: //Model: public class Group { public int Id { get; set; } public File File { get; set; } } //Controller: [HttpPost] public void SaveGroup([FromBody]Group group) {} //Formatter: public class MultipartFormFormatter : MediaTypeFormatter { private const string StringMultipartMediaType = "multipart/form-data"; public MultipartFormFormatter() { this.SupportedMediaTypes.Add(new MediaTypeHeaderValue(StringMultipartMediaType)); } public override bool CanReadType(Type type) { return true; } public override bool CanWriteType(Type type) { return false; }

How to implement HttpMessageHandler in Web API?

老子叫甜甜 提交于 2019-11-29 03:23:15
In an ASP.NET 4.5 MVC 4 Web API project, I want to add a custom HttpMessageHandler . I've changed WebApiConfig class (in \App_Satrt\WebApiConfig.cs), as follows: public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }, constraints: null, handler: new MyCustomizedHttpMessageHandler() ); } } Then I developed MyCustomizedHttpMessageHandler : public class MyCustomizedHttpMessageHandler : HttpMessageHandler { protected override

Running Mono 3.2.0 with .NET MVC 4

陌路散爱 提交于 2019-11-29 02:33:12
I am trying to get Mono 3.0 setup to run MVC4 sites under .NET 4 and .NET 4.5. I've been working through various errors, what can I do to get it up and running? Server Configuration CentOS 5 Apache 2.2.3 3.2.0 (tarball Sun Jul 28 00:57:40 UTC 2013); ASP.NET Version: 4.0.30319.17020 2013) Latest XSP from git, as of the time of this post Apache/Mono Config MonoServerPath "/usr/local/bin/mod-mono-server4" /usr/local/bin/mod-mono-server4 contents: #!/bin/sh exec /usr/local/bin/mono $MONO_OPTIONS "/usr/local/lib/mono/4.5/mod-mono-server4.exe" "$@" Update The crux of the problem is that Mono doesn't

EntityFramework 5 use dll version 4.4.0.instead 5.0

喜你入骨 提交于 2019-11-29 02:06:43
问题 I have project based on .NET 4.0 but I need to use EntityFramework 5 in my solution. So I install it from the NuGet. After that I change target framework to .NET 4.5 (I'm using VS 2012) and rebuild project. But in reference folder I see that project use EntityFramework.dll version 4.4.0.0. Ho can I use newer version of EntityFramework? in web.config <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken

With C#, WCF SOAP consumer that uses WSSE plain text authentication?

时光怂恿深爱的人放手 提交于 2019-11-29 00:16:28
I have a WCF SOAP consumer that is implemented by Visual Studio 2012 from a WSDL. The WSDL was generated by PeopleTools. The base object is of type System.ServiceModel.ClientBase . I need the SOAP request to resemble: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://xmlns.oracle.com/Enterprise/Tools/schemas"> <soapenv:Header> <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>

Failed to load viewstate. The control tree into which viewstate is being loaded

前提是你 提交于 2019-11-28 23:31:55
I am receiving the following error message after an HTTP POST on an ASP.NET form hosted inside a UserControl: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. Here's additional info: I'm running .NET 4.5 RC It's an Umbraco 4.7-based website On my local dev machine the form works perfectly This error only occurs

ManagedPipelineHandler for an AJAX POST crashes if an IE9 user navigates away from a page while that call was in progress

主宰稳场 提交于 2019-11-28 22:00:00
Scenario: User is using IE9 (IE8/10 not affected). User has an active session. Page starts an AJAX POST (GET not affected) request to a controller with the SessionState(SessionStateBehavior.Required) attribute ( ReadOnly not affected). Something keeps this request from being immediately processed (such as another request in progress that has the session locked). While that AJAX POST is in progress, the user navigates away from the page (GET or POST - doesn't matter) Result: AJAX POST terminates and returns an HTTP 500 (which the browser has since quit listening for, but you can see it in the

How to use OpenID providers with unique identifier URLs in ASP.NET MVC4

北战南征 提交于 2019-11-28 18:57:28
The new SimpleMembershipProvider implemented in ASP.NET MVC4 allows easy, built-in support for two popular OpenID providers (Google and Yahoo) and three OAuth providers (Microsoft, Facebook, Twitter). The providers implemented in DotNetOpenAuth.AspNet.Clients for use with the SimpleMembershipProvider all use static URLs for their identity services --- that is, all users use the same well-known URL to access the provider. The users' OpenID identifiers are separate from the URL used to access the identity service. For example, Google's OpenID service URL is https://www.google.com/accounts/o8/id

Using Claim-Based Authorization

 ̄綄美尐妖づ 提交于 2019-11-28 15:23:07
问题 The new ASP.NET 4.5 code has "re-parented" the ASP.NET RoleProvider to a ClaimsProvider. What I'm trying to figure out, is what would a "claims based" example of authorization look like (preferably in MVC4)? How does my Authorize attribute interact, or not, with this capability? The WebSecurity and Roles API havn't changed; there is no "DoesUserHaveClaim()" signature. Similarly, it is not clear how the Authorize attribute interacts with claims. Was this "claims authorization" feature intended