Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

IP6 Addresses and Vista in ASP.NET

On this page:

Here’s a nice gotcha you might want to think about. Vista ships with IP Version 6 and this may in some situations affect how IP Addresses are returned by your Web applications.


As part of my ASP.NET tools I have a request logging module that hooks into the pipeline and picks up and logs requests to a database as part of the application. One of the things that gets logged is the IP Address. Since for the longest time we could be reasonably sure of what constitutes an IP address with a length of 15 characters.


Well I just got bit by this fixed length as I was testing an application locally and realized that the log inserts where failing with the ever so friendly:


String or binary data would be truncated. The statement has been terminated.


Took a while to figure out why all of a sudden these calls where failing, but rest assured it’s the new IP6 address which looks something like this:


Request.UserHostAddress = "fe80::18ce:34b5:e7e6:dd8%12"


Somehow I suspect that’s not quite a valid result – certainly the %12 doesn’t look right (then again I’m still running Vista RC1).


There’s a lot more information available – this WikiPedia IP6 entry is helpful.


In any case – it’s important to remember that it’s possible that IP address are going to be quite a bit longer. It looks 39 (4  * 8 + 7 )  chars are going to be required to house a full IP6 address.


For the time being IP6 isn’t going to be an issue for servers, but on client Vista machines IP6 is enabled by default and so internally it’ll run through IP6 stack for localhost requests.


You can turn off IP6 – actually seems reasonable for the time being since most likely your routers and modems don’t support it anyway <s>…

Posted in ASP.NET  

The Voices of Reason


November 14, 2006

# re: IP6 Addresses and Vista in ASP.NET

Hey Rick,

Could the log have a FormFeed (0Ch) being added to the end of the address? Don't know why a FF would be tacked on there instead of a CRLF pair, but it's just a thought...

Rick Strahl
November 15, 2006

# re: IP6 Addresses and Vista in ASP.NET

Marty - I don't think so. I noticed this is actually happening on two machines one running RC1 one running RC2. IPConfig also shows the %12 (or whatever number) at the end.

Rick Strahl's Web Log
December 07, 2006

# CLR Data Performance Counter Failures - Rick Strahl's Web Log

So I’m revisiting my performance counters that I run on my Web site that provide some rudimentary performance monitoring for my site. It’s useful to keep track of the number of open SQL Connections, number of pooled connections in the CLR pool, StateServer Sessions and a few other things.&nbsp;I’ve...

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024