Tuesday, March 29, 2011

How to run 32-bit ASP.NET Applications on 64-bit Windows server

In my workstation I have used 32bit PC. There is no problem every this is working nice. But an unexpected situation arise recently when I try to deploy my application in to a 64 bit windows server. I never face this problem before.

Don't worry Technet library(Microsoft) is there. Just one line need to execute to solve my problem.

Actually I need to configure IIS to run 32-bit ASP.NET Applications on 64-bit Windows server.For this, we must configure IIS to create 32-bit worker processes. For more information about running 32-bit applications on 64-bit Windows.

IIS cannot run 32-bit and 64-bit applications concurrently on the same server.To enable IIS 6.0 to run 32-bit ASP.NET applications on 64-bit Windows.

Follow this steps:


1.Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.

2.Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true

3.Press ENTER.

Now your 64 bit server is ready for run 32 bit application.

Some Important information

Before you configure IIS to run 32-bit applications on 64-bit Windows, note the following:

1.IIS only supports 32-bit worker processes in Worker Process Isolation mode on 64-bit Windows.

2.On 64-bit Windows, the World Wide Web Publishing service can run 32-bit and 64-bit worker processes. Other IIS services like the IIS Admin service, the SMTP service, the NNTP service, and the FTP service run 64-bit processes only.

3.On 64-bit Windows, the World Wide Web Publishing service does not support running 32-bit and 64-bit worker processes concurrently on the same server.

After configure problem may occurs

After you configure IIS 6.0 to run 32-bit Web applications, IIS stores 32-bit DLLs and ISAPIs in the %windir%\syswow64\inetsrv directory. All other IIS files, including the MetaBase.xml file, are stored in the %windir%\system32\inetsrv directory.

File access to the System32 and sub directories are transparently redirected based on the bitness of the process making that file access (64-bit processes have full access, while 32-bit processes have access to System32 redirected to Syswow64).

If your legacy applications have specific 32-bit file access needs and you notice application failures, see if the application needs to reference the new %windir%\syswow64\inetsrv to resolve the problem.

For more information visits here.

What is HTTP Handler and HTTP Module in asp.net? Co-Relation and Differences

I have little bit confusion about HTTP Handler and HTTP Module. Then I move to community and get a huge response. After studying for a while now I get a clear idea. Now sharing with you hope that it will also help other guys.


What is HTTP handler?


An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler. You can create your own HTTP handlers that render custom output to the browser.(msdn)

HTTP handlers process the request and are generally responsible for initiating necessary business logic tied to the request. Custom handlers must implement the System.Web.IHttpHandler interface. Additionally, a handler factory can be created which will analyze a request to determine what HTTP handler is appropriate. Custom handler factories implement the System.Web.IHttpHandlerFactory interface.

ASP.net execution process(Image source:MSDN)

What is HTTP Module?

An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life-cycle events throughout the request. HTTP modules let you examine incoming and outgoing requests and take action based on the request.(msdn)

HTTP modules are executed before and after the handler and provide a method for interacting with the request.
Custom modules must implement the System.Web.IHttpModule interface. Modules are typically synchronized with events of the System.Web.IHttpModule class (implemented within the Global.asax.cs or .vb file).

The following consists of a list of events that should be considered when implementing your module:

1.BeginRequest
2.AuthenticateRequest
3.AuthorizeRequest
4.ResolveRequestCache
5.AcquireRequestState
6.PreRequestHandlerExecute
7.PostRequestHandlerExecute
8.ReleaseRequestState
9.UpdateRequestCache
10.EndRequest
11.PreSendRequestHeaders
12.PreSendRequestContent
13.Error

Co-Relation
The co-relation between HTTP handler and HTTP module is both are an integral part of the ASP.NET application.
Every request flows through a number of HTTP modules, which cover various areas of the application (i.e. authentication and session information). After passing through each module, the request is assigned to a single HTTP handler, which determines how the system will respond to the request. Upon completion of the request handler, the response flows back through the HTTP modules to the user.


Differences


HTTP Module
1.It represents more something like an modulare peace of code that's similar to another Global.asax.
2.It represent code that is in play for all page requests.
3.These are objects which also participate the pipeline.

HTTP Handler
1.Its a handler for one request.
2.It is more like a single page.
3.These are the end point objects in ASP.NET pipeline.
4.These are essentially processes the request and produces the response

Tuesday, March 22, 2011

Javascript library for Dom inspector

Very recently, I have need to develop an application using JavaScript by which when any user click on an image of this site it will send image URL to a specific location. There is another business behind it.

After binged I get nice script which is solved my problem.

Now share this with you , hope that it will help other developers.

http://userscripts.org/scripts/review/3006

JavaScript Numeric Format - Decimal Precision

Today's discussion about JavaScript number format based on decimal precision. Round a number to a certain number of places you can use JavaScript built-in methods toFixed and toPrecision. This two methods toFixed and toPrecision are part of the Number object. Any browser that supports ECMAScript version 3 should support toFixed and toPrecision.

How to use?
Its very simple and easy to use. Let's see some example which is help us to understand better.

Example : toFixed()

Use toFixed to set precision after the decimal point. It doesn't matter how large the number is before the decimal point. For normal decimal formatting, this is your best option.

// Example: toFixed(2) when the number has no decimal places
// It will add trailing zeros
var num = 10;
var result = num.toFixed(2); // result will equal 10.00

// Example: toFixed(3) when the number has decimal places
// It will round to the thousandths place
num = 930.9805;
result = num.toFixed(3); // result will equal 930.981

Example: toPrecision ()
Use toPrecision when you're setting the overall precision. Here, it matters how large the number is before and after the decimal point. This is more useful for mathematical purposes than for formatting.

// Example: toPrecision(4) when the number has 7 digits (3 before, 4 after)
// It will round to the tenths place
num = 500.2349;
result = num.toPrecision(4); // result will equal 500.2

// Example: toPrecision(4) when the number has 8 digits (4 before, 4 after)
// It will round to the ones place
num = 5000.2349;
result = num.toPrecision(4); // result will equal 5000

// Example: toPrecision(2) when the number has 5 digits (3 before, 2 after)
// It will round to the tens place expressed as an exponential
num = 555.55;
result = num.toPrecision(2); // result will equal 5.6e+2

Floating-point errors

toFixed and toPrecision are subject to floating-point errors.

Here is a test where the starting number is 162.295. The following should show the JavaScript results:

162.30 // toFixed(2)
162.30 // toPrecision(5) 162.29 // toFixed(2)
162.29 // toPrecision(5)

Do they show up correctly as 162.30 in your browser? Most JavaScript implementations will display it as 162.29

Here is basically what happens when rounding 162.295 to two decimal places

num = 162.295
num *= 100 // 16229.499999999998
num = Math.round(num) // 16229
num /= 100 // 162.29

As you can tell, it's in the second step that the number changes from its actual value.

Monday, March 7, 2011

Android-based applications using C# : MonoDroid

MonoDroid is a development stack for using C# and core .NET APIs to develop Android-based applications.



MonoDroid will be a commercial product licensed in a similar fashion
to our Mono for iPhone product MonoTouch.

To quickly get started read the installation guide and our Tutorials. If you have questions, you can contact us or discuss directly with the MonoDroid community on the mailing list, or in our IRC Chat.

You should familiarize yourself with the API, the API Design, MonoDroid's architecture, the list of class libraries that are part of MonoDroid, MonoDroid's Limitations.

Download MonoDroid from here
http://mono-android.net/

For sample you can visit
http://www.c-sharpcorner.com/UploadFile/mahesh/5795/

Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'

Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...