My previous article show how to capture network traffic between outlook client and exchange server with RPC over TCP. Now lets look at how to capture network traffic with RPC over HTTP.
1. Enable "Outlook Anywhere" on your Exchange server. Follow this link Enable Outlook Anywhere.
2. Now enable your outlook to use HTTP. Follow this link Setting Up Email (RPC over HTTPS).
Since all prep has now completed just follow the steps...
public string aboutme {
var known = { { "C#" , "Javascript" }, { "ASP.NET", "MVC" } };
return known.ToJson();
}
Friday, 16 December 2011
Capturing network traffic between outlook client and exchange server (RPC over TCP)

Analysing network traffic between outlook client and exchange server will help you decide network requirements connecting your datacenters to your users (ie.. using RPC over TCP). Wireshark is a simple tool that we are going to use to capture network traffic [ Download Wireshark ].
Information you should know before hand:
- IP address of...
Tuesday, 13 December 2011
Using images in Microsoft’s Sharepoint Wiki

Today I was creating a wiki page for a project and want to show the design inside the wiki page. Ok that was not too difficult as wiki page editor provides an option to select an image. So I have tried using the link to image as "file://C:/Users/saif/Desktop/elapsedtime.png" but that did not work.
So I have created a picture library as per...
Labels:
TFS
Wednesday, 7 December 2011
ASP.NET MVC using fileresult to export data in unicode
Exporting data to a file is a common feature websites provides to its customers. Now consider if the website is used by customers around the world, then this export data should support localization and globalization. Here is the snippet of code relating to WriteFile() for exporting data:-
protected override void WriteFile(HttpResponseBase response)
{
response.Clear();
response.ClearContent();
...
Labels:
ASP.NET MVC
ASP.NET MVC not rendering correct dateformat using CultureInfo
Reading "DateTimeFormat" using cultureinfo is not getting clients date format with the following code :-
CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(HttpContext.Current.Request.UserLanguages[0]);
DateTimeFormatInfo dtInfo = cultureInfo.DateTimeFormat;
After debugging the code, the dateformat is not honouring globalization ie.. if the client is in US but application is deployed in UK then the format is rendered...
Labels:
ASP.NET MVC
Tuesday, 6 December 2011
Using session locking with EnableSession = true
Locking session object for each webservice is simple as just adding [WebMethod(EnableSession = true)] for each of the webmethods that require locking. At the same time if you also want to lock an object that is/will be part of the session object then
Declare a static object
public static object lock_updatesharevalue = new object();
Now use this object in the webmethod to enable locking for an object in session
[WebMethod(EnableSession...
Labels:
ASP.NET,
ASP.NET MVC
Monday, 5 December 2011
NHibernate : Arithmetic overflow error converting expression to data type int
As mentioned in SQL Server Error : Arithmetic overflow error converting expression to data type int article to use cast() in sql to correctly typecast for large numbers, Now this can be achieved using NHibernate & Fluent Hibernate as per the snippet below:-
var criteria = session.CreateCriteria();
criteria.SetProjection(Projections.ProjectionList()
.Add(Projections.Count("ID").As("ID"))
.Add(Projections.Sum(Projections.Cast(NHibernateUtil.Int64,...
Labels:
NHibernate
Friday, 2 December 2011
SQL Server Error : Arithmetic overflow error converting expression to data type int
After running a simple aggregate sql "select sum(imagesize) from images" is producing following error:-
Arithmetic overflow error converting expression to data type int
The table "images" is a very simple, having datatype of imagesize as bigint. The table has at least 2 million rows and should not be a problem at all.
Tried number of options but no luck and finally found out the issue is actually because of the aggregate function...
Labels:
SQL SERVER 2008
Monday, 28 November 2011
Apply JQueryUI for html element browse or input type=file
Jquery UI provides very best features that can be applied to html controls, one such feature is applying JQuery UI styling for buttons. Applying button style as such is very easy, but how can this be applied for a html element input(type=file).
Now that looks little tricky. Ok first consider following html :
Now bind events
$(document).ready(function () {
$('#btnBrowseAttachment').button();
...
Labels:
JQuery UI
Thursday, 20 October 2011
Generate summary using multiple aggregations with NHibernate
NHibernate allows adding multiple aggregations at the same time for a single ICriteria and generates multiple objects. Below sample shows how this can be achieved
using (var session = _sessionFactory.OpenSession())
{
ICriteria criteria = session.CreateCriteria(typeof(InvoiceLine));
criteria.Add(Restrictions.Where(i => i.Invoice.ID == 1234));
criteria.SetProjection(Projections.ProjectionList()
...
Labels:
NHibernate
Wednesday, 19 October 2011
Using NHibernate Criteria with Join to get row count
Google for lot of places for using Criteria object having joins and get rowcount either by using Projections.RowCount or CriteriaTransformer.TransformToRowCount. Now I have started looking into NHibernate source code which does also provides with examples of how to use it.
So the example is as follows :-
public void TransformToRowCountTest()
{
ISession s = OpenSession();
ITransaction t = s.BeginTransaction();
...
Labels:
NHibernate
Wednesday, 12 October 2011
Add or Modify model data before submit in ASP.NET MVC when using jQuery Form Plugin
Having recently started using ASP.NET MVC for a website I am quite impressed the way MVC framework works as opposed to standard ASP.NET web forms.
Also coupled the website with jQuery Form Plugin which works seamlessly with ASP.NET MVC. jQuery Form Plugin basically provides various options such as
beforeSubmit - to validate before submitting data
success - to refresh/update content after success form submition
All works great,...
Labels:
ASP.NET MVC
Friday, 16 September 2011
javascript or .js files not loading properly for static html file in chrome, firefox works fine in IE
Kind of feeling itchy since couple of weeks for not being able to find out why javascript or .js files not loading properly for static html file in chrome and firefox, but works absolutely fine in IE.
Ok now used browser debugging tools, IE show the .js files loaded successfully and works fine. But chrome/forefix shows script were loaded like gibberish (chineese,japanese something like that). Something fishy going on, but how...
Labels:
JavaScript
Tuesday, 13 September 2011
JQuery dialog inside update panel generating duplicate elements
JQuery dialog is a nice feature provided by JQuery UI, having said care should be taken when using dialog boxes inside an update panel.
Consider a dialog box is inside an update panel as shown below :-
Blogger Name
Blogger email
Now javascript for displaying the dialog
var btnAddBloggerData= $("#btnAddBloggerData");
btnAddBloggerData
.unbind("click")
.bind("click", function () {
...
Labels:
ASP.NET Ajax,
JQuery UI
Monday, 12 September 2011
Visual studio 2010 run post build events based on debug or release mode
Using a batch file that should be run after post build is a common task. But some actions are not required in debug mode and some times in release mode.
To achieve this create 2 batch files
1. debugpostbuild.bat
2. releasepostbuild.bat
Update post-build event command line as follows:-
1. goto VS2010 -> right click on your project -> properties -> Build Events
2. copy below code
if $(ConfigurationName) == Release...
Labels:
VS 2010
Thursday, 1 September 2011
Structure of jqGrid after generating html and its contents

Something which might be useful for everyone using jqgrid.
JQGrid HTML structure:
for short form refer to the following link stackoverflow.com.
Errors using inadequate data are much less than those using no data at all.
Charles Babbage...
Labels:
JQGrid
Wednesday, 24 August 2011
Formatting date in XSL using .NET standard formatting
Microsoft standard .NET date format can be used in xsl transform which is a key feature provided using msxsl:script Element.
The following snippet demonstrates using .NET "ToShortDateString" inside XSL transform:-
Above defined method "ToCSharpShortDateString" can be used as follows:-
Now that xsl is ready, lets use this with ASP.NET xml control . Code behind should look something like this.
XmlDocument doc = new...
Thursday, 18 August 2011
jqGrid error at line $t.p.colModel[lvc].width += cr;

Recently I am getting an error in jqGrid plugin at the following line :-
$t.p.colModel[lvc].width += cr;
After debugging through the code this issue occurs with in the function
setGridWidth: function (nwidth, shrink)
.....
$t.p.colModel[lvc].width += cr;
.....
where nwidth is null
So while calling method setGridWidth on a grid make sure...
Labels:
JQGrid
Friday, 12 August 2011
Using SQL Server Compact with FluentNHibernate
FluentNHibernate is an alternative to NHibernate that supports Object Relational Mapping framework. Actually FluentNHibernate is build on top of NHibernate that provides strongly typed mapping using c# as opposed to xml mapping (.hbm.xml).
SQL Server CE (Compact edition) is commonly used for small applications as this would not need any packaging and is a simple file copy.
Using FluentNHibernate with SQL Server CE 3.5 file has...
Labels:
FluentNHibernate
JQGrid extension to track row selection between pages
Have been using JQGrid for quite some time now and was pretty impressed with the jqGrid plugin itself.
Ok now, how about extending jqGrid for tracking selection between pages. Here is a jquery extension that does the job.
; (function($) {
$.jgrid.extend({
enableTracking : true,
gridTrackingIds : null,
TrackPageSelection: function (Rowids, selected, currentpageno) {
var currentPage...
Labels:
JQGrid,
JQuery Plugin
Tuesday, 9 August 2011
JQGrid sorting with date and time column using localization
Have been using JQGrid for quite some time now and have got stuck with unable to sort on DateTime columns. But finally managed a way to be able to handle this. Not only to allow sorting but also should be able use localization and display/sort in current local format.
Not use if this is the right way and works for me. The various DateTime formats available are listed at DateTime formats. Assuming the default date format is "The...
Labels:
JQGrid
Wednesday, 27 July 2011
ASP.NET MVC with SQL SERVER giving error "The SELECT permission was denied on the object 'account', database 'accounting', schema 'dbo'"
Developed an ASP.NET mvc application and ready to publish. Now steps anyone would have generally followed :-
1. Create an new application pool "AccountingAppPool" with ".NET Framework version" as v4.0.30319
2. Assign "Identity" as "NetworkService"
3. Publish the web application to http://localhost/Accounting/
4. Assign application pool as "AccountingAppPool"
5. Now check web.config
for connection string
.....
.....
6....
Labels:
ASP.NET MVC
Thursday, 23 June 2011
Using jQuery tabs with ASP.NET MVC

Developing websites using ASP.NET webforms does have its benefits. Now why not give a try with ASP.NET MVC. Ok Here is a simple article that describes about using jquery tabs for MVC application.
As everyone know ASP.NET MVC template provides menu options for various actions, now why not provide the same options with jquery tabs. Here is...
Labels:
ASP.NET MVC
Friday, 17 June 2011
Google charts in xsl
Google charts is a simple and easy way to provide charts on a webpage. Refer to
Google Charts for more info.
A simple chart can be produced using img tag
Using the same in xsl will not work as the charactors ?,& etc will not be recognized as you would expect. Hence you should give this as
src="https://chart.googleapis.com/chart?chs=250x100&chd=t:60,40&cht=p3&chl=Hello|World"...
Labels:
XSL
Disable a button after onclick inside an update panel
Avoiding users to click on a button more than once can be done as follows :-
btnSubmit.Attributes.Add("onclick", "this.disabled=true;" + Page.ClientScript.GetPostBackEventReference(btnSubmit, "").ToString());
This method is quite nice but if you would want to apply for entire website then you would have to duplicate the code in every page, usercontrols etc. Instead this simple script allows you to handle once for all
var prm...
Labels:
ASP.NET Ajax
Friday, 20 May 2011
Finding the count of entities using using ObjectContext in Entity Data Model
The best part of using Entity Data Model designer is having the facility to use LINQ with the objectcontext.
Now consider you have the object-layer code created as follows-
///
/// No Metadata Documentation available.
///
public partial class InventoryEntities : ObjectContext
{
//autogenerated code
///
/// No Metadata Documentation available.
///
public ObjectSet Products
{
get
...
Labels:
ADO.NET
Object-Layer Code not getting updated correctly
Generating Object-Layer Code is the easiest way to generate code for database instead of writing the for yourself. refer to Generating Object-Layer Code
Code can be generated for Object-Layer as follows:-
1. Create an Entity Data Model design
2. Right click on EDM design and select "Update Model from Database..."
3. Select the database and select the required table
4. Select finish to get the code generated
The code is now...
Labels:
ADO.NET
Wednesday, 4 May 2011
Improving Performance of JQGrid for millions of records : Part2
This article will address more from ASP.NET point of view assuming you have already read Part 1
Now that you have all the back-end available lets get on with developing the website.
Start with the usual steps
1. Create an ASP.NET website
2. Add the required java scripts (JQuery, JQueryUI, JQGrid plugin)
3. Now add a new web service to the project and name it InvoicingService
InvoicingService.cs should look like
[WebMethod,...
Labels:
ASP.NET Ajax
Improving Performance of JQGrid for millions of records : Part 1
JQGrid plugin does not require any introduction for itself. As everyone already knows the fact that JQGrid plugin is a powerful plugin for serving data from server to the client. Also it provides very good features such as sorting, paging, filtering etc.
Now lets look at how JQGrid can be used in ASP.NET for serving millions of records with out having the following effects:-
- website hanging
- memory leaks
- page time out
-...
Labels:
ASP.NET Ajax
Create Work Item Template for Team
Work item templates are very good option to apply a set of changes for a group of work items( for eg: bugs). But have you come across having difficulty not to be able to have shared work item templates, if so just follow these simple steps and you can achieve it.
Before creating a work item template, choose a shared location where each of team member have access such \\csharptechies\workitemtemplates, if you do not already have...
Labels:
VS 2010
Thursday, 7 April 2011
Stumbled upon decision to use either cross tab or pivot in SQL Server
Here is what it is..
Create a set of views which uses pivot using SQL Server 2008 express. All goes fine if the record count is in 1000's .... Testing with 20,000 found no issues what so ever with performance.
Now dealing with a million records, struggling with performance of 4 min's for simple query run.
Googling about this, have found a nice article
Cross Tabs and Pivots
As the article states using cross tab would give...
Labels:
SQL SERVER 2008
Friday, 18 March 2011
Displaying JQGrid as defaulted with multiple search conditions
Just as you would apply default search condition for JQGrid its easy to apply multiple search conditions.
But this would need some more parameters, firstly enable multiple searches using the parameter "multipleSearch: true"
The code would as follows :-
$(function () {
var GetFilters = function () {
var filters = null;
var filterData = { groupOp: "OR", rules: [] };
filterData.rules.push({ field: "id", op: "eq",...
Labels:
JQGrid
Displaying JQGrid with default search condition
Being using JQGrid for sometime, have at one point required to display data in jqgrid but with a default search condition.
Its as simple as just passing data using the parameter serializeGridData in jqgrid
$(function () {
var defaultsearchField = "id";
var defaultsearchString = "5";
var defaultsearchOper = "gt";
jQuery("#grid").jqGrid({
url:'GetDetails.asmx?team=All',
datatype: "json",
colNames:['ID','Name','Country','Progress'],...
Labels:
JQGrid
Thursday, 10 March 2011
Using word wrap for text using css for words with out spaces
Many web pages contains some information which needs to be displayed using word wrap. consider a small example as below:-
Here is some content for the div element
CSS used in the above example will process the text with word wrap but only if it can find a space. If you would like to have a word warp for long words that does not have space then the CSS would be
Here is some content for the div element veryveryveryverylargewordwithoutspace
Three...
Labels:
CSS
Thursday, 10 February 2011
Generate client side script with custom control in ASP.NET
As you already know custom control gives the flexibility and allows to add complex features for a server control (refer to MSDN:Developing and Using a Custom Web Server Control).
Now consider you would like to display modal dialog using JQuery UI and the respective .js files are already loaded by the main website.The following snippet allows you to display a button from your custom control and generate a script block on the...
Labels:
ASP.NET
Wednesday, 5 January 2011
Passing vArguments or dialogArguments with window.open
Arguments can only be passed with window.showModalDialog which is quite helpful. But consider your application is using these arguments extensively in your website and suddenly it appears modal dialog is not supported on all browsers. Opera does not support modal dialog, now instead of changing the existing functionality the work around would be as follows:-
1. Detect if browser support modal dialog or not and then assign arguments
var...
Labels:
JavaScript
Subscribe to:
Posts (Atom)