Get the IR Stream and control the IR Emitter – Kinect for Windows SDK

In this post I am going to talk about how to capture the Infrared stream from the Kinect sensor and control the IR emitter using Kinect for Window SDK. This feature is available with the Kinect for Windows SDK v1.6. The major components for a Kinect device consists of a depth sensor, color camera, IR Emitter, and a set of microphones with everything secured inside box. The box is attached to a small motor working as the base that enables the device to be tilted.

JScript Debugger– “Unable to attach the process. Another debugger might be attached to the process” – while application is running from Visual Studio. [ Solution ]

IE Developer toolbar provide us a fantastic and easiest way to debug JavaScript with in browser.  If the web site is hosted on IIS and you are trying  debug JavaScript using IE Developer tool bar, it will work fine if you the correct browser setting for debugging. If you are running your web application directly from visual studio, you might came across the problem of “Unable to attach to the process”  while click on “Start debugging” button in IE Developer toolbar. In this post I am going to talk about the resolution of the same and will also talk about little bit behind the scene.

Few Nice features in Visual Studio 11 Developer Preview for ASP.NET Developers

Visual Studio 2011 developer preview introduced many great features. These  includes IDE features such as HTML Editor Enhancements,  Debugging features, parallel computing improvements, SharePoint development features etc. You can read the Announcing Visual Studio 11 Developer Preview post from Jason Zander’s WebLog to know more about the newly launched Visual Studio. In this post I am going talk few of  nice features of Visual Studio 2011 developer preview  related with ASP.NET.

Use Visual Studio 2010 to Profile your ASP.NET Application which is hosted on IIS

Most of all are well aware about command line profiling for ASP.NET Application using  VSPerfASPNETCmd command line tool . This can easily profile your ASP.NET Web applications which is hosted on IIS. We just need to run VSPerfASPNETCmd command with required parameter. Once profiling done, we can inspect the generated performance  report (.vsp) file within Visual Studio. But, do you know we can do the complete profiling within Visual Studio itself. How ? Here you go.

Few important tips that you should know while using ASP.NET Session

While working with ASP.NET web application you must be familiar with one of most important state management technique “Session”. If you want to do a quick refresh or want to know some thing more, please go ahead and read one of my article “Exploring Session in ASP.NET” published at Code Project. In this post I am going to share some important tips that might be useful.

Customizing Visual Studio Extension Icon in Visual Studio 2010

If you have deal with Visual Studio Extension ( VSIX) , you must have seen, after the extension installation default icons are predefined ( As shown in below image ). In this post I am going to describe how you can customize /change the default visual studio extension  icon and can provide your own icon over there.

Creating a simple Context Sensitive Help for ASP.NET Controls using jQuery

In this blog post I am going to explain how we can create a simple  Context Sensitive Help for ASP.NET Controls using jQuery. This has been done based on the selection of a controls in a ASP.NET Web Form. On control selection / focus  jQuery Loads a  HTML Content from a remote file, then it’s apply the filter based on the control id and inject the filtered content into a predefined placeholder  with in the DOM Hierarchy.

ASP.NET Custom Repeater Control with EmptyTemplate, ShowHeaderWhenEmpty,ShowFooterWhenEmpty,ShowCount Properties

If you have worked with ASP.NET GridView Control you must be aware of GridView.EmptyDataTemplate Property  which Gets or sets the user-defined content for the empty data row when a GriimagedView control  data source has no records. Similarly ShowHeaderWhenEmpty property allows you to show or hide the Header row when there is no records. These are the really good and very frequent required properties. Now, if you are working with the Repeater Control, it doesn’t have any direct features which enables you to set user define content when data source is empty. In this blog post I will discuss how we can create a custom ASP.NET Repeater control with support of EmptyTemplate along with few more important features.

Track Changes and Advance Scroll Mode in Visual Studio 2010

In the recent update of Visual Studio 2010 productivity power tool  there are few new interesting features introduced.   You can download the Productivity tool from http://bit.ly/9nybU6 .  There are certain new features like Quick Find which allows you find and advance find dialog option with in code editor with nice highlighting features, nice enhancement of add reference window. kunal chowdhury has some nice blog post where he talked about  above two new productivity tool features. You can find the post over http://bit.ly/hDa0si and http://bit.ly/grhGAI . In this post I am going to talk about another nice and most interesting features of Power Productivity Tool which “Enhanced Scroll Mode”.  

Run ASP.NET Web Application from Command Prompt

Visual Studio has its own integrated ASP.NET Runtime engine, which helps to run any ASP.NET web application with in Visual Studio.  While running application from Visual Studio, you must have seen a popup notification in System Tray (As shown in below image) , which is notification of ASP.NET Development Server.

image

This ASP.NET Development Server is nothing but a executable file (WebDev.WebServer) which used by Visual Studio to execute you web application when it’s running in the context of Visual Studio.  You can find the executable file at <\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0> . This folder contain two different executable

  • WebDev.WebServer20.EXE
  • WebDev.WebServer40.EXE

WebDev.WebServer20 is targeted to CLR 2.0, which means all the ASP.NET Application which are targeted till FW .NET 3.5 will be taking care by WebDev.WebServer20.EXE and WebDev.WebServer40.EXE for ASP.NET 4.0 based application.

Now, let’s see how we can use these executable to run an ASP.NET 4.0 Application with out using Visual Studio. Surprised smile

How to make ViewState secure in ASP.NET ?

The ASP.NET ViewState is a client side state management.  ViewState is stored in hidden field with ID named __VIEWSTATE. Typically, stored ViewState information  looks as below:

image 

Now let us look at the value. It looks likes an encrypted string. This is nothing but Base64 Encoded string and it is not an encrypted string.  So it can be easily decoded.

The main reasons for making it Base64 encoding are as follows:

1.  Base64 makes a string suitable for HTTP transfer

2. It makes it a little harder to read .

But people often get confused that this is an encrypted string.

Details explanation on Compression Enabled Session for SQL Server and State Sever Session Mode in ASP.NET 4.0

While we are talking about state management we consider Session is one of  most useful server side  state management mechanism for a web application.  In ASP.NET mainly we are having two type of state management  1. In Process  and 2. Out Process . In process is the by default session imagestorage mode for ASP.NET Web application and this is taken care by worker process in IIS. When it comes under Out Process we can use either of state server or SQL Server to persist session data. In case of In Process, session data stored in In memory of worker process. But when we are talking about OutProc session mode, we need to ensure that session data should be Serializedfirst . So, when we are moving session data from Web Server to Out Process Server ( State Server or SQL Server ) it can be a performance overhead based on the size of data that we are storing in Session.

ASP.NET 4.0 comes with a new option for compressing the Session data with Out Process Session mode. To enabling this functionality we need to add “compressionEnabled=”true” attribute with the SessionMode in web.config .

Programmatically Changing Session State Behavior in ASP.NET 4.0

Session is one of most important state management in ASP.NET. We can enable or disabled session state either in web.config or using @Page directive’s   EnableSessionState attributes. But there was no provision to change the session state at runtime till date in ASP.NET. But using  ASP.NET 4.0, we can change the session  state programmatically . The .NET 4.0 framework adds a new method SetSessionStateBehavior  to the HttpContext class for ASP.NET. This method required SessionStatebehavior  value to set the current session mode. To call SetSessionStateBehavior   simply create a new HttpModule by Implementing IHttModule and hook the BeginRequest event. Most important you can only use the SetSessionStateBehavior  until the AcquireRequestState event is fired, because AcquireRequestState  Occurs when ASP.NET acquires the current state  that is associated with the current request

While calling SetSessionStatebehavior, You can pass the following values as SessionStatebehaimagevior  :

  • Default: This is default setting which means  everything works as before
  • Disabled: Turned of Session Sate for Current Request.
  • ReadOnly: Read only access to Session State;
  • Required: Enabled session state for both Read and Write Access;

When we can use HttpContext.Current.Items to stores data in ASP.NET?

To answer this question In a single statement, you can use HttpContext.Current.Items for very short term storage. By Short term storage means, this data is valid for a single HTTP Request.  There are many confusion around regarding storing data in HttpContext.Current.Items and storing data in Session variable. In this blog post I am going to describe what are the different scenarios where we can use HttpContext.Current.Items and what is the exact difference with session variable.

Items collections of HttpContext is and IDictionary key-value collections and that are shared across a single HTTPRequest. Yes, HttpContext.Current.Items  valid for  a single HTTPRequest.  Once after processing, server  information  is sent back to the browser, the variables that were set in the Items[] collection will lost. Where as for Session Variable, information valid for multiple request as this is user specific. The session variable only  expires either on Session Time Out or explicitly clear the values.