jQuery and ASP.NET

October 5, 2009

How to determine if your ASP.NET application is running as a 32-bit or 64-bit application




When I was first asked this question, I thought to look at the System.IntPtr struct. On further investigation, I found a very simple technique suggested by Perica Zivkovic.

Here’s how to determine if your ASP.NET application is running as a 32-bit or 64-bit application

C#

protected void Page_Load(object sender, EventArgs e)
{
if (IntPtr.Size == 8)
{
Response.Write("Running as a 64-bit app");
}
else if (IntPtr.Size == 4)
{
Response.Write("Running as a 32-bit app");
}

}

VB.NET

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If IntPtr.Size = 8 Then
Response.Write("Running as a 64-bit app")
ElseIf IntPtr.Size = 4 Then
Response.Write("Running as a 32-bit app")
End If

End Sub

Note: There could be a possibility that you are running a 32-bit .NET Framework on a 64-Bit Windows OS. Check a cool technique described by Raymond How to detect programmatically whether you are running on 64-bit Windows



'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

1 Response to "How to determine if your ASP.NET application is running as a 32-bit or 64-bit application"
  1. Jay said...
    October 6, 2009 10:33 AM

    great...
    this is the easiest way to detect an environment.

 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions