Wednesday, July 3, 2013

Cross orgin Resource Sharing CORS now is dynamic MVC5 and VS2013 review release.

The enhancement to decisively include CORS configuration dynamically will prove to be good move in new release of .net framework. Yes, the resource sharing across different services such twitter, facebook and many more. Its a way to allow resource across domain depending upon the level of interaction. The point is not to narrate many things here. To keep discussion short and up to point. VS2013 and MVC5 preview release has gotten into new innovation to configure CORS dynamically.

Highlights we can have:
Now we can configure CORS via database . No require to restart service. Client access can be configured at runtime.


public interface ICorsPolicyProvider
   7:      {
   8:          /// 
   9:          /// Gets the .
  10:          /// 
  11:          /// The request.
  12:          /// The cancellation token.
  13:          /// The .
  14:          Task GetCorsPolicyAsync(HttpRequestMessage request, CancellationToken cancellationToken);
  15:      }
 
Important Attributes that can be applied to controller methods.
 
 
[EnableCors("*", "*", "*")]
[DisableCors]
 
For more details check this out. MSDN Blog
 

No comments :