Posts

Showing posts with the label Tips-Trick

Caching in MVC with Donut Caching - excluding caching login

The main purpose of using caching is to dramatically improve the performance of your application. This is nothing but output caching that means whatever you see is cached, and exact similar things is display to everyone.
I recommend you to read Output Caching in MVC post before you read here, because you should be very careful when using any caching mechanism. Or, if you already know output caching, keep reading here only.
Biggest problem you face
If you display user login status on page which you want to cache, then you need to be careful. With output cache attribute [OutputCache(....)] caches everything on page and it will not exclude caching of some portion like login status.
In the situation, the best caching library you should use is Donut Caching (aka Donut Output Caching). Let’s understand its uses.
Using Donut Caching
The best way to add donut caching to your MVC project is to use the NuGet package. From within Visual Studio, select Tools | Library Package Manager and then choo…

Credential parameter can only be used with Organization ID credentials - Azure Deployment or Continuous Deployment Error

Image
I faced this error while Azure Web App Deployment starts in after Continuous Integration. Here's the detailed information you see in the error:

-Credential parameter can only be used with Organization ID credentials. For more information, please refer to http://go.microsoft.com/fwlink/?linkid=331007&clcid=0x409 for more information about the difference between an organizational account and a Microsoft account. There was an error with the Azure credentials used for deployment.

 Error Screenshot:


If you face this issue, here's quick way:

Step 1

Edit existing build definition and select "Azure Web App Deployment" and then click on "Manage".


Now you will be redirect on new tab.

Step 2

On new tab click on "Update service configuration" and this will open a dialog box where you need to select "Certificate Based" option and then fill up the details. You can click on "Publish settings file" to download, this file will have everything…

Moving SQL Azure to local SQL or Azure SQL to VM SQL

Image
There are many requirements like moving database between:

1. SQL Azure to local development SQL Server 2. SQL Azure to Virtual Machine SQL Server 3. Development SQL Server to Production SQL Server 4. Production SQL Server to Development SQL Server

Rename database data files and logical files in SQL Server

When I rename database using SQL Server Management Studio I always change its data files (mdf, ldf) name as well as logical file name of the resource. And this is very common need for SQL Server guy.

How to remove/update default header and footer from PayPal sandbox page

Image
I was updating an old website that uses PayPal as one of the payment gateway option. When I was testing the website I realized default header and footer texts.

Search in selected file types Visual Studio

Image
This is a very important feature which is worth useful when making necessary changes that may match in multiples file types but you are only supposed to change in selective files types.

Export table data into excel file

Exporting table data (DOM data) on the HTML page to excel file is a very common requirement. The simplest approach or say the completely client side approach to achieve this is to export the DOM data using client side scripts.

Remove Header & Footer from Print Preview in Google Chrome

Image
Recently I had a requirement when one printing the web page should not display header and footer, basically they are automatically inserted by the browsers. Here is what this looks like:

What is LESS (style-sheet language)? Exploring LESS coding features inside Visual Studio - Web Essential?

Image
In this post we are going to talk about LESS and its introduction, coding, compilation and features available in Visual Studio Editor with Web Essential extension. Before talking about anything let’s understand what is LESS and how it can help developers.

Creating Image Sprite in Visual Studio - Web Essential

Image
In this article you will learn how to create image sprite using Visual Studio Web Essential Extension. Suppose you have a website that uses lots of images and each image loads individually which increases number of requests and makes website slow. We need quick website optimization to fix it.

Paste Image from clipboard onto Visual Studio Editor : Video - Web Essential

In this article you will learn how to paste clipboard image onto Visual Studio Editor. Like we can paste clipboard image in MS-Word, it is possible to paste in Visual Studio Editor with the help of Web Essential Visual Studio Extension.

Image Optimization in Website - Web Essential

Image
In this article you will learn about Image Optimization using Web Essential Visual Studio extension. You will learn how we can optimize individual image by right clicking on image file, how to optimize group of images in the folder, how to optimize image in CSS file and how to optimize Base64 Encode Image (dataUri) in CSS file.

Base64 Encode Image in Website - Web Essential

Image
In this article you will learn about Base64 Encode Image, why we encode image and how it can improve website performance. We are going to make use of Web Essential which is a must have Visual Studio extension.

Logging Errors with ELMAH (Error Logging Modules And Handlers) in MVC 4

Image
ELMAH is an alternative to HMS (Health Monitoring System) for logging errors which is free and available under open-source which is created and managed by Atif Aziz. HMS was (was...why?) great (with few pains) because it has option to capture all events as well as errors. With HMS developers has to design the UI for viewing the log information but with ELMAH, you just need to hit a URL to view log information.

Removing or Customizing View Engines in MVC

Image
In this article you will learn how to remove or customize View Engines which is not being used by application.

Auto-Implemented Properties for trivial Get (getter) and Set (setter) in C#

Image
In the example given below, you will look at a very good example on auto-implemented properties for trivial get (getter) and set (setter).


There is a shortcut way to create property with its definition just by pressing keyboard keys.


Find here Tips: shortcut way to create properties in C#


using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Automatically_Implemented_Properties { classProgram     { staticvoid Main(string[] args)         { // Intialize a new object. Customer cust1 = newCustomer(500.50, "Abhimanyu", 12); //Modify a property             cust1.TotalPurchases += 0.50; Console.WriteLine("Total Purchase = " + cust1.TotalPurchases); Console.WriteLine("Name = " + cust1.Name); Console.WriteLine("Customer ID = " + cust1.CustomerID); Console.ReadKey();         }     } //Customer Class classCustomer     { // …

Tips: Commenting and Uncommenting codes

Image
In this video tutorial you are going to learn how to comment and uncomment your codes in a quick way.



Tips: shortcut way to create properties in c-sharp

You could type "prop" and then press tab, that will generate the following.

public TYPE Type { get; set; }

Then you change "TYPE" and "Type"

public string myString {get; set;}

You can also get the full property typing "propfull" and then tab, that would generate the field and the full property.

private int myVar;
public int MyProperty{
get { return myVar;}
set { myVar = value;}}

Popular posts from this blog