SteveOH

Tag: asp.net

ASP.NET ServerVariable Collection

by on Jan.21, 2009, under Technology

Syntax
Request.ServerVariables (_variable)
Parameter Description
server_variable Required. The name of the server variable to retrieve

Server Variables

Variable Description
ALL_HTTP Returns all HTTP headers sent by the client. Always prefixed with HTTP_ and capitalized
ALL_RAW Returns all headers in raw form
APPL_MD_PATH Returns the meta base path for the application for the ISAPI DLL
APPL_PHYSICAL_PATH Returns the physical path corresponding to the meta base path
AUTH_PASSWORD Returns the value entered in the client’s authentication dialog
AUTH_TYPE The authentication method that the server uses to validate users
AUTH_USER Returns the raw authenticated user name
CERT_COOKIE Returns the unique ID for client certificate as a string
CERT_FLAGS bit0 is set to 1 if the client certificate is present and bit1 is set to 1 if the cCertification authority of the client certificate is not valid
CERT_ISSUER Returns the issuer field of the client certificate
CERT_KEYSIZE Returns the number of bits in Secure Sockets Layer connection key size
CERT_SECRETKEYSIZE Returns the number of bits in server certificate private key
CERT_SERIALNUMBER Returns the serial number field of the client certificate
CERT_SERVER_ISSUER Returns the issuer field of the server certificate
CERT_SERVER_SUBJECT Returns the subject field of the server certificate
CERT_SUBJECT Returns the subject field of the client certificate
CONTENT_LENGTH Returns the length of the content as sent by the client
CONTENT_TYPE Returns the data type of the content
GATEWAY_INTERFACE Returns the revision of the CGI specification used by the server
HTTP_<HeaderName> Returns the value stored in the header HeaderName
HTTP_ACCEPT Returns the value of the Accept header
HTTP_ACCEPT_LANGUAGE Returns a string describing the language to use for displaying content
HTTP_COOKIE Returns the cookie string included with the request
HTTP_REFERER Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
HTTP_USER_AGENT Returns a string describing the browser that sent the request
HTTPS Returns ON if the request came in through secure channel or OFF if the request came in through a non-secure channel
HTTPS_KEYSIZE Returns the number of bits in Secure Sockets Layer connection key size
HTTPS_SECRETKEYSIZE Returns the number of bits in server certificate private key
HTTPS_SERVER_ISSUER Returns the issuer field of the server certificate
HTTPS_SERVER_SUBJECT Returns the subject field of the server certificate
INSTANCE_ID The ID for the instance in text format
INSTANCE_META_PATH The meta base path for the instance of IIS that responds to the request
LOCAL_ADDR Returns the server address on which the request came in
LOGON_USER Returns the account that the user is logged into
PATH_INFO Returns extra path information as given by the client
PATH_TRANSLATED A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping
QUERY_STRING Returns the query information stored in the string following the question mark (?) in the HTTP request
REMOTE_ADDR Returns the IP address of the remote host making the request
REMOTE_HOST Returns the name of the host making the request
REMOTE_USER Returns an unmapped user-name string sent in by the user
REQUEST_METHOD Returns the method used to make the request
_NAME Returns a virtual path to the script being executed
SERVER_NAME Returns the server’s host name, DNS alias, or IP address as it would appear in self-referencing URLs
SERVER_PORT Returns the port number to which the request was sent
SERVER_PORT_SECURE Returns a string that contains 0 or 1. If the request is being handled on the secure port, it will be 1. Otherwise, it will be 0
SERVER_PROTOCOL Returns the name and revision of the request information protocol
SERVER_SOFTWARE Returns the name and version of the server software that answers the request and runs the gateway
URL Returns the base portion of the URL
Leave a Comment :, , , , , , more...

ASP.NET Charting Control! :)

by on Dec.03, 2008, under Technology

recently released a cool new control – <asp:chart /> – that can be used for free with 3.5 to enable rich browser-based charting scenarios.

LINK

Leave a Comment :, , , more...

uCertify Review – MCTS 70-536: VB.NET 2.0 Application Development Foundation

by on Jul.30, 2008, under Technology

I was contacted by a Public Relations individual from uCertify who requested me to their product.  This was quite some time ago, and since I had never used their product before, decided to test their test preparation software out in addition to others.  This short will not mention other applications, suites or books for the preparation for this exam, only the uCertify application.

The first thing you’ll notice when you download the program, is that they offer a few things.  First, there’s 100% money back guarantee that you’ll pass the test on the first try.  That’s enticing and speaks volumes on their product.  Unfortunately, the money back guarantee is on the ~$70 you spent on the program, and not the $150+ on the exam, but alas, something is better than nothing.  At the very least, you can use that money and try again on the exam (or buy a different prep book).

Second, they offer 2 flavors of their software: a full and free (demo) version.   The demo version has a few questions, enough to give you an idea of what’s going on, but not enough for you to do anything with (ie. pass the test, study from, etc).

Lastly, I like the fact that they give you directions on download and install the application.  That’s very thoughtful for users who may not be highly technical but want to be, and are therefore attempting to get certified in a particular (this is becoming more and more common, even though the certification is supposed to be taken after experience has been attained in the work place, to validate your skills).

So let’s run the application.

As a software developer myself, I have to say that I like the initial interface a lot.  Everything is very well place and easy to navigate.  The demo version only has a Diagnostic Test (15 questions), Create a Custom Test and Create a Fixed Time Test available to you in the main navigation section.  The “Enhance your understanding” section on the right hand side has all of the items available, which are basically extras to give you an ‘edge’.  It’s mostly general information, some tips, and other resources you can find on the internet.  You don’t need this section, but it’s nice to have everything in one place anyway.

uCertify has their advertisements all over the place “Buy the full version”, which makes me laugh.  That’s what they’re supposed to do, and they do a pretty good in keeping it in your face as you go through the demo.

Diagnostic Test:

I ran it with 10 total questions, 10 minute duration and a passing score of 730.  I also selected the “Always show last answer option as ‘None of the above’” which I believe to be crucial in getting you to think critically.  Why?  Because everyone will default themselves to “the answer must not be here” if they can’t figure it out or come up with an answer based on incorrect assumptions.  Since it’s there all the time, and you won’t know when it’s a valid option, you’ll definitely think twice before choosing it.  In my courses, I always have this option available to students.

Well, the first thing I noticed while taking the Diagnostic Quiz is that my settings didn’t stick.  I noticed at the bottom that I was on question 10 of 15 (I said a max of 10) and that the “Always show ‘none of the above’” wasn’t being shown on all questions.  Maybe this is reduced functionality for the demo, but it would have been nice to see that stated.

I found the questions a bit vague.  They’re not meant to confuse you, but require a good understanding of the underlying topic for you to know what they’re referring to.  The application does assist you with some background information and explanation, but I don’t believe it to be enough for a full understanding of the topics, but again, they are quite helpful.

The results page is fairly straight forward.  A little hard to read, maybe alternating row colors would have been nicer on the eyes.  Anyway, it tells you what you did right and wrong.  Clicking on the question will take you to the page of that question, with the answer you gave and why you were right or wrong, along with those ‘Facts’ that help you solidify your understanding.

I really like the Readiness report, which gives you a summary on how you’ve done on all the exams (there are 5 practice tests, a final test, and a diagnostic test – 423 questions in total).  They also provide an adaptive test, but that functionality is not available, so I cannot comment on it.

All in all, I believe this to be a good product.  It’s obvious the uCertify is trying to get you to pass the test, as they provide you with several ways of doing so.  If I were going to use this product, I would read a book prior to build a decent foundation, and then polish my skills and knowledge off with this application and its exams.  If you did that, you would have taken 7 tests in the uCertify application, and an additional 1 or 2 in the book, for a total of 8 or 9.  You would iterate through the content and examinations enough to know what you have to study and understand better, and know where your strengths are.

If you used the approach above, it would cost you about $100 (Microsoft Self-Paced Certification Books – really the only books available for MCTS-) and $60 for the uCertify application.  That’s $160 in prep (and maybe 1 – 3 months) and then the cost of the exam, which is about $200 or so (don’t quote me on that).  When you buy the Microsoft books, you get a voucher for a discount on the actual exam, so that helps. I believe it to be worth it.

The from the exams is that you need to really memorize the book’s content and have lots of coding experience (more project experience than just slapping code together).  In that respect, an application such as this one will really help you with that, as they ask you real-world type questions.  The link below is to a site of a gentlemen who gives his experience from taking the exam: here

Rating of the Application:

Visual Appeal: 8
Question Difficulty: 8
Extra Content to Help (ie. Tips): 10
Number of Questions / Exams: 9
Reporting: 9
Exam Preparedness: 8.5
Overall: 8.75

I would say this will help anyone pass the exam, as long as they have the knowledge.  I would / will use this in the future.

Take a look for yourself: http://www.ucertify.com/exams/Microsoft/70-536-VB.html

You can receive a 10% discount on any certification course you wish to attend using the code STEVEH.  Thank you to Roger and uCertify for their generosity.

1 Comment :, , , , , , , , , , , more...

ASP.NET: Accessing files on a Network Share

by on Jul.11, 2008, under Technology

Now, there are plenty of places to find resources on this issue, because it’s quite common to have to do so.  My issue, was a little different, in that there were multiple layers of (authentication and authorization) for me to access the files that were needed.  Here’s what the setup looked like:

Web -> WorkGroup -> Firewall -> Domain -> File -> Share -> SAN

As you can see, there are several issues are hand.  Not only do the accounts have to exist to allow for this communication (and an Administrator account is the only way to go), all sorts of permissions have to be valid for this to function (ie. Local Permissions within each OS on each Server, NTFS (file permissions) on each local server, Access permissions through the Firewall, Access permissions of Domain Resources, Local level permissions, etc).  It was a nightmare, but I believe I figured it out.

There are a few things that needed to be done in this situation.  First, the permissions on the SAN needed to allow Administrators full control.  Additionally, the local user on the file server needed to have administrative privileges, to both the and the SAN, thus allowing the network share.   Next, the firewall rules needed to allow file traffic (I can’t remember the SMB ports right now – and needs netBios and something else to let file transfers go through, as well as authentication).  Finally, the Web Server local user needs admin rights.

To get this to work, I needed everything involved to run with elevated privileges, from , to each thread in the application.  Since there was going to be a large amount of file movement, as well as resource and memory manipulation, it’s required.

Therefore, the admin credentials were inputted into IIS to map the network share from the Web Server to the File Server.  Next, I had to impersonate the admin user in each thread within the application, a pain, but the guide can be found via Google (if I have time, I’ll track them down again). Next, the machine.config needed to be modified to allow the process to run with the elevated permissions.  The web.config needs to be altered to allow impersonation with the credentials as well.

Now here’s the kicker, and something that’s not quite known but buried within ’s documentation.  For this to work (Work Group computer to authenticate to another computer) is to mirror the accounts (same username and password) on both servers (these are local accounts, not domain accounts – since the share was local on the server, the domain can be bypassed. If it were a domain resource, we would have to authenticate via NTLM to an Active Directory server, which would have been a bit more complicated).  This allows the hash sent from one system to another to be identical, and thus, you will authenticate (if you know the username and password on one workgroup computer, and it’s the same on another, chances are you’re who you say you are).

This took me a week to figure out, which was not enjoyable.  I hope this saves you some time.

Leave a Comment :, , , , , , , , , more...

ASP.NET / VB.NET: Get File Size

by on Jul.11, 2008, under Technology

If you want to get the size of a file using (VB), here’s how.  I used this to check if the file is big enough.  If it’s too small (in my application), an error existed and the user was told to contact the Administrator.

Dim fileName As String = "myFile.jpg"
Dim myFileInfo As New FileInfo(.MapPath(fileName))
Dim fileSizeBytes As UInt32 = myFileInfo.Length

Response.Write("File: " & fileName & "<br>Bytes (B): " & fileSizeBytes & _
               "<br>Kilo Bytes (KB): " & fileSizeBytes / 1024 & "<br>Mega Bytes (MB): " & _
               fileSizeBytes / (1024 ^ 2) & "<br>Giga Bytes (GB): " & _
               fileSizeBytes / (1024 ^ 3))

Note that this only works for files that already exist ‘locally’, not those that are in ‘transport’.  Meaning, you can use this for files on the local server, over the , etc, but you cannot for files pre- or during uploading, only after they’ve been uploaded and saved to the server.

 I hope this saves you some time… or at least a lengthy search on Google.

2 Comments :, , , more...

ThickBox 3.1 within ASP.NET UpdatePanel

by on Jun.28, 2008, under Technology

So, out of the box, this just doesn’t work.  Here’s the situation.

Thickbox works fine before any async postbacks by the updatepanel.  However, once the updatepanel is reloaded (does a postback), thickbox will no longer work and will render your links regular HTML links.

The Reason

The reason for this is when the updatepanel posts back, the javascript is reloaded but is not initialized, nor is it registered with the DCOM.

Add the following code to the pageLoad method in your AJAX enabled page, so that it looks something like this:

< type=”text/javascript” language=”javascript”>
function pageLoad()
{
var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
if (isAsyncPostback) {
tb_init(‘a.thickbox, area.thickbox, input.thickbox’);
}
}
</script>

This code will check if there is an async post back being fired, and if so, will re-initialize thickbox.

I search around for at least 4 hours until I was able to piece together some solutions.  This is the best one.

Good luck.

UpdatePanel ATLAS AJAX ThickBox modal iframe

38 Comments :, , more...

ASP.NET: MD5 Hashing of Passwords

by on May.10, 2008, under Technology

Imports ..Cryptography

    Function MD5_me(ByVal txt As String) As String
Dim strPlainText As String = txtPassword.Text
Dim hashedDataBytes As Byte()
Dim encoder As New UTF8Encoding()
Dim x As Integer
Dim hashedStr As String = “”

Dim md5Hasher As New MD5CryptoServiceProvider()

hashedDataBytes = md5Hasher.ComputeHash(encoder.GetBytes(strPlainText))

For x = 0 To hashedDataBytes.Length – 1
hashedStr += hashedDataBytes(x).ToString()
Next

MD5_me = hashedStr
End Function

Leave a Comment :, , more...

Where is ASP.NET 3.5 on IIS?

by on May.07, 2008, under Technology

Where is 3.5 on ?

Most people on installing .NET 3.5 on the “expect” an entry for  v3.5 under the ASP.NET version Tab in IIS manager. And not finding that entry start panicking. If you have been one of those read on. The more tech savvy folks try to run aspnet_regiis -i from the v3.5 framework folder… but even that is missing :)

vijaysk-no35

That brings us to the question

What exactly is ASP.NET 3.5 ?

Take a look at the v3.5 framework folder you will not find most of the files needed for ASP.NET to run like aspnet_isapi.dll / aspnet_filter.dll / aspnet_regiis.exe / aspnet_regsql.exe…

The reason being .NET 3.5 is not a stand alone framework like v2.0 or v1.1 . It is just an extension of the 2.0 framework. The extension provides developers with new language features like Anonymous Types, Extension Methods, Lambda Expressions and of course LINQ …. and AJAX is now integrated … also you have a few new ASP.NET controls <asp:ListView>, <asp:LinqDataSource>, <asp:DataPager>

Will I get ASP.NET version 3.5 under the ASP.NET tab in IIS 6.0 ?

Nope. Because as far as IIS is concerned nothing has changed. The aspnet_isapi.dll from the version 2.0 folder will still handle the requests and there is no new ISAPI dll specific to version 3.5. So you don’t have to change any Mappings in IIS …just leave the web application pointing to v2.0 under the ASP.NET Tab. And this brings us to the next question

What exactly is the extension ?

For that if you have Visual Studio 2008 go ahead and create a Website targeting the .NET 3.5 framework. Then go to the Property Pages of the Website and select References. You will find an entry like this

vijaysk-references

And those four assembly references provide the new features of v3.5.  Here is a 10,000 ft view of the functionality implemented in these assemblies

.Core – Provides namespaces like .Linq, .IO

System.Data.DataSetExtensions – LINQ to DataSet

System.Web.Extensions – AJAX

System.Xml.Linq – New XML API.. supports LINQ to XML

Do I have to configure anything manually ?

No. When you install the .NET 3.5 redistributable on the server it installs these assemblies in the GAC. And any website that refers to these assemblies can fetch them from the GAC so you do not have to configure anything manually. All you need to do is publish the content to a web application that is marked with ASP.NET v2.0

And now you should be thinking

The new language features should require a new compiler. How exactly is the new compiler used ?

The answer is your web.config file. When you create an ASP.NET 3.5 website in Visual Studio 2008 an entry is made in the web.config something like

<system.codedom>
  <compilers>
    <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
              type=".CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <providerOption name="CompilerVersion" value="v3.5"/>
      <providerOption name="WarnAsError" value="false"/>
    </compiler>

The new features do require a new compiler to be used and the web.config tells .NET that the v3.5 compiler has to be used.

What about IIS 7.0 ?

IIS 7.0 is no different.

vijaysk-iis7apppool

Leave a Comment :, , , , , , , , , , , more...

Visual Studio 2005 or 2008? What’s more risk?

by on Mar.12, 2008, under Technology

Should I stay or should I go … with Visual Studio 2005 or 2008 is the question in this particular case. One of my customers is still on Visual Studio 2003 and they are wondering whether to upgrade to VS 2005 or to VS 2008.

Are there reasons for moving to VS 2005 instead of 2008 even though 2008 is so close to release? Minimizing risk is probably the major driver for deciding on VS 2005. After all, it’s been out in the market for almost two years and it’s stable and mature. There’s also the common wisdom that you shouldn’t deploy a product that doesn’t have at least one service pack. Mind you that SP1 for Visual Studio didn’t come out until 12 months after the release of the product. is no longer in the mode where the Service Pack has to hit 6 months after release because there were quality issues that needed to be fixed.

When it comes to determining to move to the newer Visual Studio 2008 and the .NET Framework 3.5 there are more points to consider:

1) Stability and maturity of the underlying framework and consequently the applications you’re building on top of the framework.

2) Stability and maturity of new features added with VS 2008

3) Product Support differences.

4) benefits of VS 2008 compared to VS 2005.

Let’s dive a little deeper and examine each of these points:

1) Enhancements to the .NET Framework are built around the stable core of Version 2.0 that ship with Visual Studio 2005, when additions like generics and partial classes required modifying the CLR.

Version 3.0 added to the core set of .NET 2.0, but does not change the core CLR. New functionality is packed in new assemblies, e.g. .ServiceModel. There were some minor changes to some of the library assemblies, e.g. .Runtime.Serialization to accommodate new WCF functionality, but by all and large 3.0 is built around the solid core of the CLR and the BCL of 2.0.

Version 3.5 follows the same approach. The 2.0 CLR/BCL core remains largely untouched. New features are either implemented at the compiler level or in the System. Core assembly. Scott Hanselman (who’s finally joined Microsoft) confirmed this claim by doing some deeper research recently. He compared the core libraries that shipped with VS 2005 and the Beta 2 release of .NET 3.5 and found that the percentage of churn was in the single digits.

Since the .NET Runtime and the core libraries are pretty much the same between VS 2005 and VS 2008, there’s no increased risk for applications that leverage core .NET functionality only.

2) Now that we realized that .NET is very stable at its core, let’s look at the additional functionality that’s new with .NET 3.5. There are quite a number of new features (WCF, WPF, Visual Studio, Linq, too many others), but this particular customer is very interested in the new AJAX features. Again, the core framework code at the Ajax framework level has been in the public as a CTP since 2006 and has been RTM since early 2007. The Visual Studio 2008 release is adding more side control features (for example control extenders), but the core has been publicly available as a preview release for more than 18 months. Another customer I work with is running one of the world’s largest eCommerce sites on top of AJAX some of these CTP bits without impact to their business.

Visual Studio 2008 adds time tools and more server controls for richer UIs and better communication between the client-side code and the server. Those features are very helpful and the runtime features have been available in CTPs for a while.
Finally, one more risk mitigation factor to consider is recent announcement
that source code (with comments) and debugging symbols are going to be available with Visual Studio 2008 and .NET Framework 3.5. If you’re running into issues, you have the unprecedented ability to trouble shoot and diagnose problems.

With all that, my take would be (if I was an architect that didn’t work for Microsoft) that risk from new framework libraries around ASP.NET AJAX is manageable. In other areas, you get all the fixes for .NET 3.0 SP1, which means there’s actually a benefit of fewer pieces to install. The remaining risk is the new code in System.Core and in some other places. Still, I’d feel good about moving to 2008.

3) Now, you may argue that the tools are still new, and there’s some truth in that. Even though the quality of Visual Studio has been pretty good, much better than in the 90s when I first looked at Microsoft tools, but new code is always new risk. One could argue that VS 2005 + VS 2005 SP1 + .NET 3.0 + .NET 3.0 SP1 + ASP.NET AJAX RTM + AJAX Control Toolkit + ASP.NET AJAX Futures CTP gives me the same capabilities as VS 2008 with more stable, proven code. But consider this: The AJAX Control Toolkit is released under a community license, which means there’s not official product support through the Premier Support channels. The ASP.NET AJAX Futures CTP delivers some of the cool improvements over RTM, but the CTP is an unsupported product. The new controls that ship with VS 2008 are fully supported.

You’re actually increasing risk a little bit by staying with Visual Studio 2005 because of a few unsupported bits and you’re greatly increasing complexity of your install . With VS 2008 you get the stable service pack code for Visual Studio and .NET 2.0 and 3.0 and you get all that in a single install and you get all that in a single install which reduces complexity and consequently risk and cost of deployment. I give that one to Visual Studio 2008.

4) Yes, there is new code in Visual Studio 2008 and there better be ;) . VS 2005 has been lacking the tool support to take full advantage of the .NET 3.0 platform. VS 2005 shipped with .NET 2.0, remember? The .NET 3.0 release was only a framework release. The tool support for WPF, WCF and ASP.NET AJAX is finally shipping with VS 2008.

The improved Javascript IntelliSense support alone is a great enhancement for somebody like me that delegates mundane tasks like remembering method overloads and signatures to IntelliSense. AJAX was painful because IntelliSense in the code editor was rather limited.

Then there’s the client-side JavaScript debugging Scott Guthrie was talking about. You now can set breakpoints from the start, debug and inspect javascript variables with property grids, visualizers and an immediate window just like you can in with managed code on the server.


Then there are other very helpful new features, like the ability call WCF JSON services, the Web Designer with rich CSS Support or the built-in support to make the back button AJAX aware with the history control and, of course , Linq. There are many other exciting new features, too many others to list here, but the bottom line is, there are numerous reasons why VS 2008 is the better choice for developing AJAX enabled sites.

Finally, you could argue that VS 2008 actually gives you the best of both worlds because VS 2008 lets you target different versions of the .NET Runtime. If you’re feeling very strongly about shipping applications on the 2.0 bits or the 3.0 bits, you can still take advantage of the new productivity enhancements in the IDE but build against the framework version of your choice.That’s a great combination or productivity and stable code to optimize for low risk.

Published Monday, October 08, 2007 9:01 AM by ChristophDotNet

Leave a Comment :, , , , , , , , , , , , , more...

New Project – Fitness Tracker

by on Jul.02, 2007, under Projects

A new project to add to my list of projects is a fitness tracker utilizing (VB.NET) and AJAX.

The general functionality of the application is as follows:

  • Track excercise (duration, intensity, etc)
  • Track diet (foods, portions, calories, etc)
  • Reporting Features (up to date graphs of calories, etc)
  • Body fat evaluator
  • Weight tracker
  • Diet, fitness and weight planner

More to come…

Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!