Redirection problem with dyndns.org, IIS 6.0 and ASP.NET

Web Programming258
Hello!



For testing reasons, I am hosting an ASP.NET 2.0 based website on my

local MS Windows Server 2003. Let's say, the application name would be

"foo", so I am publishing the site with VS2005 to my local address:



http://servername/foo



Locally, everything works fine (of couse ;-). The application is

defined in IIS6.0, the SQL Server is up and running and so on.



For testing that web in better context, I set up a dyndns.org acount

for that server. Again, that would be:



foo.dyndns.org



When I do access my site via the address foo.dyndns.org/foo,

still everything works out fine. But for some cross-site issues and for

field tests I wanted to use a "real" domain name. So I set up a

redirection from foo.com to foo.dyndns.org/foo by means

of my ISP.



When I now do access the site using foo.com, it is perfectly

redirected to foo.dyndns.org and I do see the requested page.

But - and this is the problem - all URIs generated by the ASP.NET

engine have the application name inserted after the hostname. In other

words, ASP.NET resolves the link ~/secure/login.aspx to

foo.com/foo/secure/login.aspx instead of

foo.com/secure/login.aspx.



Strangely enough, this does not seem to be true for all kind of links

generated by ASP.NET. Some are resolved ok, some are broken. In detail:



- Links stated with <asp:HyperLink>are resolved ok (without "/foo"

inserted)

- URLs in <asp:Image>are resolved ok

- Sitemap controls are *not* ok ("/foo" inserted in link address,

~/default.aspx becomes foo.com/foo/default.aspx instead of

foo.com/default.aspx)

- Method ResolveClientUrl() is *not* ok

- Redirections from web.config are *not* ok (redirect to

foo.com/foo/...)



Actually, I really don't understand what I'm getting wrong. Especially

the inconsitant behaviour of the different ASP.NET controls really

leaves me irritated. Any help is appreciated.



Thanks in advance.

Michael W. Folz.



(Crossposted to microsoft.public.interserver.aspnet.general)


-