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.
Sharing real-world experiences about C#, Dynamics CRM, Dynamics 365, Dynamics NAV/Business Central, SharePoint,PowerBI,ASP.net and more...
Tuesday, March 29, 2011
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.
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
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
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.
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/
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/
Monday, February 28, 2011
Thin Vs. Thick Clients
Basically, a thin client is a web based application and most of the processing is done on the server side.
A thick client is installed into the client side. It is still connected to the server, but most of the processing is done on client side. With thick client, there won't be much processing via the network. In a way, it will be a much faster option if your network is slow or congested.
The codes are different for thick and thin clients. I think if you code in components, you can reuse the code about 60% - 80% of the time depending on the requirements.
More specific..
Thin Client: Is a Web Application, and runs on Internet Explorer. You access the application using http://hostname:portNumber/iSupport=20 Here you have a webserver and database in the background. It can be 2-tier or N-tier.
List of protocols used with thin clients
* Appliance Link Protocol
* Citrix ICA
* Remote Desktop Protocol
* Secure Shell or SSH, an encrypted replacement for telnet.
* Virtual Network Computing
* X11, central to Unix windowing
* XML, HTML, or JSON over HTTP (Ajax)
* DisplayLink over USB
* NFS
Thick Client: Is the Application which runs on Windows. It's like any other Windows based program/software. It can be accessed on the same system on which you have it installed.
Advantages of thick clients
1. Fewer server requirements. A thick client server does not require as high a level of performance as a thin client server (since the thick clients themselves do much of the application processing). This results in drastically cheaper servers.
2.Offline working. Thick clients have advantages in that a constant connection to the central server is often not required.
3.Better multimedia performance. Thick clients have advantages in multimedia-rich applications that would be bandwidth intensive if fully served. For example, thick clients are well suited for video gaming.
4.More flexibility. On some operating systems software products are designed for personal computers that have their own local resources. Running this software in a thin client environment can be difficult.
5.Using existing infrastructure. As many people now have very fast local PCs, they already have the infrastructure to run thick clients at no extra cost.
6.Higher server capacity. The more work that is carried out by the client, the less the server needs to do, increasing the number of users each server can support.
A thick client is installed into the client side. It is still connected to the server, but most of the processing is done on client side. With thick client, there won't be much processing via the network. In a way, it will be a much faster option if your network is slow or congested.
The codes are different for thick and thin clients. I think if you code in components, you can reuse the code about 60% - 80% of the time depending on the requirements.
More specific..
Thin Client: Is a Web Application, and runs on Internet Explorer. You access the application using http://hostname:portNumber/iSupport=20 Here you have a webserver and database in the background. It can be 2-tier or N-tier.
List of protocols used with thin clients
* Appliance Link Protocol
* Citrix ICA
* Remote Desktop Protocol
* Secure Shell or SSH, an encrypted replacement for telnet.
* Virtual Network Computing
* X11, central to Unix windowing
* XML, HTML, or JSON over HTTP (Ajax)
* DisplayLink over USB
* NFS
Thick Client: Is the Application which runs on Windows. It's like any other Windows based program/software. It can be accessed on the same system on which you have it installed.
Advantages of thick clients
1. Fewer server requirements. A thick client server does not require as high a level of performance as a thin client server (since the thick clients themselves do much of the application processing). This results in drastically cheaper servers.
2.Offline working. Thick clients have advantages in that a constant connection to the central server is often not required.
3.Better multimedia performance. Thick clients have advantages in multimedia-rich applications that would be bandwidth intensive if fully served. For example, thick clients are well suited for video gaming.
4.More flexibility. On some operating systems software products are designed for personal computers that have their own local resources. Running this software in a thin client environment can be difficult.
5.Using existing infrastructure. As many people now have very fast local PCs, they already have the infrastructure to run thick clients at no extra cost.
6.Higher server capacity. The more work that is carried out by the client, the less the server needs to do, increasing the number of users each server can support.
String Format for Double [C#]
This information help me a lot to solve my currency related calculation... so share with you. Hope that it may also helpful for other guys...
The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString() and float.ToString().
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
[C#]
// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00"
Next example formats double to string with floating number of decimal places. E.g. for maximal two decimal places use pattern „0.##“.
[C#]
// max. two decimal places
String.Format("{0:0.##}", 123.4567); // "123.46"
String.Format("{0:0.##}", 123.4); // "123.4"
String.Format("{0:0.##}", 123.0); // "123"
Digits before decimal point
If you want a float number to have any minimal number of digits before decimal point use N-times zero before decimal point. E.g. pattern „00.0“ formats a float number to string with at least two digits before decimal point and one digit after that.
[C#]
// at least two digits before decimal point
String.Format("{0:00.0}", 123.4567); // "123.5"
String.Format("{0:00.0}", 23.4567); // "23.5"
String.Format("{0:00.0}", 3.4567); // "03.5"
String.Format("{0:00.0}", -3.4567); // "-03.5"
Thousands separator
To format double to string with use of thousands separator use zero and comma separator before an usual float formatting pattern, e.g. pattern „0,0.0“ formats the number to use thousands separators and to have one decimal place.
[C#]
String.Format("{0:0,0.0}", 12345.67); // "12,345.7"
String.Format("{0:0,0}", 12345.67); // "12,346"
Zero
Float numbers between zero and one can be formatted in two ways, with or without leading zero before decimal point. To format number without a leading zero use # before point. For example „#.0“ formats number to have one decimal place and zero to N digits before decimal point (e.g. „.5“ or „123.5“).
Following code shows how can be formatted a zero (of double type).
[C#]
String.Format("{0:0.0}", 0.0); // "0.0"
String.Format("{0:0.#}", 0.0); // "0"
String.Format("{0:#.0}", 0.0); // ".0"
String.Format("{0:#.#}", 0.0); // ""
Align numbers with spaces
To align float number to the right use comma „,“ option before the colon. Type comma followed by a number of spaces, e.g. „0,10:0.0“ (this can be used only in String.Format method, not in double.ToString method). To align numbers to the left use negative number of spaces.
[C#]
String.Format("{0,10:0.0}", 123.4567); // " 123.5"
String.Format("{0,-10:0.0}", 123.4567); // "123.5 "
String.Format("{0,10:0.0}", -123.4567); // " -123.5"
String.Format("{0,-10:0.0}", -123.4567); // "-123.5 "
Custom formatting for negative numbers and zero
If you need to use custom format for negative float numbers or zero, use semicolon separator „;“ to split pattern to three sections. The first section formats positive numbers, the second section formats negative numbers and the third section formats zero. If you omit the last section, zero will be formatted using the first section.
[C#]
String.Format("{0:0.00;minus 0.00;zero}", 123.4567); // "123.46"
String.Format("{0:0.00;minus 0.00;zero}", -123.4567); // "minus 123.46"
String.Format("{0:0.00;minus 0.00;zero}", 0.0); // "zero"
Some funny examples
As you could notice in the previous example, you can put any text into formatting pattern, e.g. before an usual pattern „my text 0.0“. You can even put any text between the zeroes, e.g. „0aaa.bbb0“.
[C#]
String.Format("{0:my number is 0.0}", 12.3); // "my number is 12.3"
String.Format("{0:0aaa.bbb0}", 12.3); // "12aaa.bbb3"
You will get more help from here
The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString() and float.ToString().
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
[C#]
// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00"
Next example formats double to string with floating number of decimal places. E.g. for maximal two decimal places use pattern „0.##“.
[C#]
// max. two decimal places
String.Format("{0:0.##}", 123.4567); // "123.46"
String.Format("{0:0.##}", 123.4); // "123.4"
String.Format("{0:0.##}", 123.0); // "123"
Digits before decimal point
If you want a float number to have any minimal number of digits before decimal point use N-times zero before decimal point. E.g. pattern „00.0“ formats a float number to string with at least two digits before decimal point and one digit after that.
[C#]
// at least two digits before decimal point
String.Format("{0:00.0}", 123.4567); // "123.5"
String.Format("{0:00.0}", 23.4567); // "23.5"
String.Format("{0:00.0}", 3.4567); // "03.5"
String.Format("{0:00.0}", -3.4567); // "-03.5"
Thousands separator
To format double to string with use of thousands separator use zero and comma separator before an usual float formatting pattern, e.g. pattern „0,0.0“ formats the number to use thousands separators and to have one decimal place.
[C#]
String.Format("{0:0,0.0}", 12345.67); // "12,345.7"
String.Format("{0:0,0}", 12345.67); // "12,346"
Zero
Float numbers between zero and one can be formatted in two ways, with or without leading zero before decimal point. To format number without a leading zero use # before point. For example „#.0“ formats number to have one decimal place and zero to N digits before decimal point (e.g. „.5“ or „123.5“).
Following code shows how can be formatted a zero (of double type).
[C#]
String.Format("{0:0.0}", 0.0); // "0.0"
String.Format("{0:0.#}", 0.0); // "0"
String.Format("{0:#.0}", 0.0); // ".0"
String.Format("{0:#.#}", 0.0); // ""
Align numbers with spaces
To align float number to the right use comma „,“ option before the colon. Type comma followed by a number of spaces, e.g. „0,10:0.0“ (this can be used only in String.Format method, not in double.ToString method). To align numbers to the left use negative number of spaces.
[C#]
String.Format("{0,10:0.0}", 123.4567); // " 123.5"
String.Format("{0,-10:0.0}", 123.4567); // "123.5 "
String.Format("{0,10:0.0}", -123.4567); // " -123.5"
String.Format("{0,-10:0.0}", -123.4567); // "-123.5 "
Custom formatting for negative numbers and zero
If you need to use custom format for negative float numbers or zero, use semicolon separator „;“ to split pattern to three sections. The first section formats positive numbers, the second section formats negative numbers and the third section formats zero. If you omit the last section, zero will be formatted using the first section.
[C#]
String.Format("{0:0.00;minus 0.00;zero}", 123.4567); // "123.46"
String.Format("{0:0.00;minus 0.00;zero}", -123.4567); // "minus 123.46"
String.Format("{0:0.00;minus 0.00;zero}", 0.0); // "zero"
Some funny examples
As you could notice in the previous example, you can put any text into formatting pattern, e.g. before an usual pattern „my text 0.0“. You can even put any text between the zeroes, e.g. „0aaa.bbb0“.
[C#]
String.Format("{0:my number is 0.0}", 12.3); // "my number is 12.3"
String.Format("{0:0aaa.bbb0}", 12.3); // "12aaa.bbb3"
You will get more help from here
Subscribe to:
Posts (Atom)
Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'
Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...
-
It is very common questions for new web developer how to get the client's country location to track the user.In various forum I have f...
-
There are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web serv...
-
Today I have added Google Map my asp.net application successfully !! Don't worry it's not a big deal. Very easy and you will find a ...



