.net

Store data in WCF Operation Context.Is ThreadStatic safe?

WCF infrastructure allows you to store context sensitive data in InstanceContext of the service instance similarly like we do in HttpContext of MVC. For that you should implement from IExtension and plug that class into WCF’s infrastructure. public class WcfOperationContext : IExtension<OperationContext> { private readonly IDictionary<string, object> items; private WcfOperationContext() { items = new Dictionary<string, …

Store data in WCF Operation Context.Is ThreadStatic safe? Read More »

Data Entry Form using Simple HTML Helper In MVC

HTML Helper in MVC In this article we will learn how to code for entering data form using simple HTML Helpers. Create New ASP.NET MVC4 Web Application. Select Razor As View Engine. Right click on Model ->Add new Class ->Customer Class. Right click on controller and -> Add new item-> CustomerController

Render Pdf bytes array within browser in MVC

Render Pdf within browser There are different ways to render Pdf in a browser. In this I’m explaining to render Pdf by fileContent/byte array. In a below example I’m using Index Action which returns the FileContentResult. public ActionResult Index() { Response.Clear(); Response.AddHeader(“Content-Disposition”,“inline; filename=sample.pdf”); Response.AddHeader(“Content-Type”,“application/pdf”); Response.ClearHeaders(); Response.AddHeader(“Content-Length”, byteArray.Length.ToString()); FileContentResult result = new FileContentResult(byteArray, “application/pdf”); return result; } …

Render Pdf bytes array within browser in MVC Read More »

MVC Simple Model In ASP.NET

In our previous article we have learnt basics of MVC , now in this article we will learn how to make simple model In MVC. Create New ASP.NET MVC 4 Web Application . Select Internet Website as template. Select ASP.NET as  View Engine Right Click on the model -> Add New Item ->Class -> Movies.cs

Avoid multiple call to AuthorizeCore in MVC

AuthorizeCore in MVC In MVC AuthorizeAttribute Class is another cool feature that makes it easy to add authentication at the Controller level. In AuthorizeAttribute class we have AuthorizeCore function, it specifies that access to a controller or action method is restricted to users who meet the authorization requirement. We can override AuthorizeCore  function as per our authorization logic. …

Avoid multiple call to AuthorizeCore in MVC Read More »

MVC Basics for Beginners

MVC Basics In this article you will learn some basic concepts of  MVC Architecture. So what is MVC ? An Architectural design principle that separates the components of a Web Application. This separation gives you more control over the individual parts of the application , which lets you more easily develop , modify and test …

MVC Basics for Beginners Read More »

Microsoft CacheManager Contains vs Getdata

Microsoft CacheManager Contains vs Getdata In Microsoft.Practices.EnterpriseLibrary.Caching, GetData is used to get data from the cache and Contains checks whether the key exists in the cache. Ideally if Contains(key) returns true than GetData(key) should returns data from the cache associated with the key.  But somehow it works in the different condition. In the below code block Contains(key) returns true but the block returns null.     …

Microsoft CacheManager Contains vs Getdata Read More »

Avoid Multiple ASP .NET Deployment server

Avoid Multiple ASP .NET Deployment server Annoying Right ? I used to work on different projects and during debugging I found  a bit of an annoying behavior within Visual Studio. When debugging a solution that contains multiple project/application. Visual Studio starts up a very new development web server for each project/application within your solution. After spending …

Avoid Multiple ASP .NET Deployment server Read More »

%d bloggers like this: