473,761 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.UserHos tAddress, Vista & IIS7

Hi,

Now that the VS.NET 2005 SP1 update patch is with us, I'm in the process of
moving my main development environment onto 64-bit Vista Business Edition -
so far, so good...

However, there is a bit of a gotcha with Request.UserHos tAddress...

Under IIS6 and earlier, that would return a standard xxx.xxx.xxx.xxx IP
address. However, Vista enables IP6 by default, which makes
Request.UserHos tAddress return an IP6 address e.g.
"fe80::2032:39a b:3f57:fffb%10"

Easy enough to disable IP6, of course, but does anyone know a way to return
an IP4 address from IIS7 without disabling IP6, or mucking about with
LMHOSTS...

Haven't been able to find a way so far...
http://west-wind.com/WebLog/posts/8839.aspx
http://forums.asp.net/thread/1667538.aspx

Any assistance gratefully received.

Mark

Apr 26 '07 #1
9 7949
This article shows you how to set Vista to prefer IPv4 to IPv6 when attempting connections:

http://www.microsoft.com/technet/com...uy/cg1005.mspx

To selectively disable Pv6 components and configure behaviors for IPv6 in Windows Vista,
create and configure the following registry value (DWORD type):

HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\S ervices\tcpip6\ Parameters\Disa bledComponents

DisabledCompone nts is set to 0 by default.

The DisabledCompone nts registry value is a bit mask that controls the following series of flags,
starting with the low order bit (Bit 0):

Bit 0 Set to 1 to disable all IPv6 tunnel interfaces, including ISATAP, 6to4, and Teredo tunnels.
Default value is 0.

Bit 1 Set to 1 to disable all 6to4-based interfaces. Default value is 0.

Bit 2 Set to 1 to disable all ISATAP-based interfaces. Default value is 0.

Bit 3 Set to 1 to disable all Teredo-based interfaces. Default value is 0.

Bit 4 Set to 1 to disable IPv6 over all non-tunnel interfaces, including LAN interfaces and
Point-to-Point Protocol (PPP)-based interfaces. Default value is 0.

Bit 5 Set to 1 to modify the default prefix policy table to prefer IPv4 to IPv6 when
attempting connections. Default value is 0.

So, you'd set the first 4 bits to 0 and bit 5 to 1.

That will allow IPv6, but the system will prefer IPv4.

To only prefer IPv4 over IPv6 (what you want), set the value to 0x20
To disable IPv6 over all interfaces *and* prefer IPv4 to IPv6, set it to 0xFF

You must restart the computer for the changes to the DisabledCompone nts registry value to take
effect.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message news:uj******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

Now that the VS.NET 2005 SP1 update patch is with us, I'm in the process of moving my main
development environment onto 64-bit Vista Business Edition - so far, so good...

However, there is a bit of a gotcha with Request.UserHos tAddress...

Under IIS6 and earlier, that would return a standard xxx.xxx.xxx.xxx IP address. However, Vista
enables IP6 by default, which makes Request.UserHos tAddress return an IP6 address e.g.
"fe80::2032:39a b:3f57:fffb%10"

Easy enough to disable IP6, of course, but does anyone know a way to return an IP4 address from
IIS7 without disabling IP6, or mucking about with LMHOSTS...

Haven't been able to find a way so far...
http://west-wind.com/WebLog/posts/8839.aspx
http://forums.asp.net/thread/1667538.aspx

Any assistance gratefully received.

Mark

Apr 26 '07 #2
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:u4******** ******@TK2MSFTN GP05.phx.gbl...
This article shows you how to set Vista to prefer IPv4 to IPv6 when
attempting connections:
Superb! Muchas gracias, hombron...

Apr 26 '07 #3
re:
Muchas gracias, hombron...
<chuckle>

You're quite welcome, Mark.
It just so happened that I'd just looked up the very same issue for a client.

:-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message news:O2******** ********@TK2MSF TNGP04.phx.gbl. ..
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:u4******** ******@TK2MSFTN GP05.phx.gbl...
>This article shows you how to set Vista to prefer IPv4 to IPv6 when attempting connections:

Superb! Muchas gracias, hombron...

Apr 27 '07 #4
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:ez******** ******@TK2MSFTN GP05.phx.gbl...
It just so happened that I'd just looked up the very same issue for a
client.
Aw - now you've gone and shattered my illusion...

Apr 27 '07 #5
The timing was perfect... :-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message news:eC******** ******@TK2MSFTN GP04.phx.gbl...
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:ez******** ******@TK2MSFTN GP05.phx.gbl...
>It just so happened that I'd just looked up the very same issue for a client.
Aw - now you've gone and shattered my illusion...

Apr 27 '07 #6
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:u4******** ******@TK2MSFTN GP05.phx.gbl...
This article shows you how to set Vista to prefer IPv4 to IPv6 when
attempting connections:

http://www.microsoft.com/technet/com...uy/cg1005.mspx
I think I've found a way to return the IP4 address even when IP6 is on...

Dns.GetHostAddr esses(Dns.GetHo stName()) returns an array if IP addresses for
the current host and, so far, the IP4 address always seems to be the fourth
element of the array i.e.

[0]: {fe80::288f:1d8 f:3f57:fffb%10}
[1]: {fe80::7133:861 5:3971:49d1%8}
[2]: {fe80::5efe:192 .168.0.4%13}
[3]: {192.168.0.4}
[4]: {2001:0:4136:e3 8e:288f:1d8f:3f 57:fffb}

Therefore:

using System.Net;
string strIP4Address =
Dns.GetHostAddr esses(Dns.GetHo stName())[3].ToString();

I need to do a bit more testing to see what that returns on XP / Win2k3s.

Also, it's almost certainly an extremely bad idea to rely on the numerical
position of the element within the array...

--
http://www.markrae.net

Apr 29 '07 #7
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
I need to do a bit more testing to see what that returns on XP / Win2k3s.
And here we go:

using System.Net;

public string GetIP4Address()
{
string strIP4Address = String.Empty;

foreach (IPAddress objIP in Dns.GetHostAddr esses(Dns.GetHo stName()))
{
if (objIP.AddressF amily.ToString( ) == "InterNetwo rk")
{
strIP4Address = objIP.ToString( );
break;
}
}
return strIP4Address;
}

See here for further details:
http://msdn2.microsoft.com/en-us/lib...essfamily.aspx

Apr 29 '07 #8
Good job, Mark!

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message news:uY******** ******@TK2MSFTN GP05.phx.gbl...
>I need to do a bit more testing to see what that returns on XP / Win2k3s.

And here we go:

using System.Net;

public string GetIP4Address()
{
string strIP4Address = String.Empty;

foreach (IPAddress objIP in Dns.GetHostAddr esses(Dns.GetHo stName()))
{
if (objIP.AddressF amily.ToString( ) == "InterNetwo rk")
{
strIP4Address = objIP.ToString( );
break;
}
}
return strIP4Address;
}
See here for further details:
http://msdn2.microsoft.com/en-us/lib...essfamily.aspx

Apr 29 '07 #9
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:eI******** ******@TK2MSFTN GP05.phx.gbl...
Good job, Mark!
Thanks.

Apr 29 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1383
by: nospam | last post by:
Hi, dont know if this is the correct group, but tried on vista.general and got no help. ive installed VS2005 on RC2 version of Vista and when i try to create a new website project it shows an error informing that i must install frontpage extensions. On XP with IIS 5.1 i knew were to add this, but on Vista i cant manage
8
7494
by: Darwiniv | last post by:
1. Does anyone run ASAPI and mysql succesfully on Vista /IIS7? 2. Does anyone run CGI and display all SESSION errors on Vista /IIS7? php ASAPI doesn't works with MYSQL. And CGI doesn't show any SESSION error message. PHP had so much bugs on windows vista. I using php-5.2.1-Win32
1
361
by: Joey | last post by:
asp.net 2/C#/VS2005 Does anyone know why "Request.UserIPAddress" returns an empty IPV6 address when I run (both serve and browse) my asp.net app on Windows Vista? It all works fine on Windows XP Pro: a regular IPV4 address is returned. How can I force the code to always use the IPV4 address, even on Windows Vista?
10
3092
by: hugh welford | last post by:
Hi Have just installed IIS7 on Vista and am trying to access a .mdb file through ASP. Getting server error. I think the problem is in the file permission. Under XP Pro/IIS6 is used to have to set the .mdb file security via windows explorer to give IUSR_machinename full permissions on this file for anonymous web access. Cant seem to do this with Vista explorer - says object cannot be found.
5
2679
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi, I wonder if someone could shed some light on this one for me. I have developed a web app in VS2005 with the built in server. It uses an sql database, everytihng works. I need to test it across the network, so i've installed IIS7 on my Vista machine and created a new website, point at the website's directory. After I switched to the 'Classic .net' app pool, it shows up on the port.
0
5984
by: Erwin Moller | last post by:
Hi, I am one of those questionable people that started with Vista (Home Premium). Not because I think it is a ready/steady OS, but partly out of curiousity, and partly because I needed to work on an old project that happens to run on IIS6/W2000/MSSQL7, but my W2000 machine couldn't handle the size of the database in question anymore. :-( My new Vista machine is 5 years younger and is a lot faster, so I started to figure out how to use...
4
3729
by: PW | last post by:
Has anyone used the traditional Classic ASP / Access DB / IIS configuration on Vista yet? I haven't, but before I upgrade to Vista I would like to ensure all my websites will work once I do. What version of Vista is best to use (and includes IIS) ? What problems did you have with database connectivity ?
6
9643
by: ma | last post by:
Hello, I am new to IIS and ASP.NET. I wrote my first ASP.NET and I want to deploy in to a system which has Vista Business and IIS7. I copied my files to the target computer and created a virtual directory. I add default.aspx to the list of default pages for the virtual directory. My problems are: 1- On vista computer I am trying to see the output of my ASP.NET
11
2719
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have just installed VISTA Enterprise and VS.NET 2008. When pressing F5 to debug my test ASP.NET website, IE 7 display the message "Internet Explorer cannot display the webpage". The local URL that VS.NET 2008 generates is http://localhost:49705/aaa/Default.aspx. In IIS7 Manager, ASP.NET V2.0… is "Allowed" in the ISAPI and CGI Restrictions. Also IIS7 is working and display ASP.NET web sites if I convert them to IIS7...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.