Solved

Appending sub directory to Masked Domain C#.Net

Posted on 2009-04-10
4
690 Views
Last Modified: 2013-12-17
Hi all,

Okay so I have a domain name hosted with fasthosts, I'm not cash positive at the moment so I'm hosting the website on my home computer for development purposes etc. I got the email and web forwarding package for £15pa which allows me to forward my domain name and mask it.

Here's my setup:

Domain on fasthosts: "www.mydomain.com" > Points to > "myname.dyndns.org" which in turn points to my IP Address and is updated by my router.

This works fine, however in IE if I go to www.mydomain.com just as in FF the address bar contains only the domain name regardless of which sub directory i may be in. And in the status bar I can see the proper URL "myname.dyndns.org" when I navigate around the site.

In IE if I try to post a form it won't go through, now the address in IE is still just "www.mydomain.com" but if I change it to say: www.mydomain.com/form/directory/theform.aspx everything works fine and the form goes through.

So my question is:

When I retrieve the URL as in HttpContext.Current.Request.URL.Host I get "myname.dyndns.org" and HttpContext.Current.Request.URLReferrer.Host I get "www.mydomain.com"

So is there any way to say append the orginal sub directory from the root that we're in to the URLReferrer, something like:

URL Referrer Currently:   www.mydomain.com
Actual URL:  myname.dyndns.org/dir/form.aspx

Appended Referrer: www.mydomain.com/dir/form.aspx

As I believe then everything would work fine.

I'm sorry if anyone finds me difficult to follow, I'm not very good at explaining things.

Thanks for the help in advance

Craig

PS: I tried setting up BIND 9 to resolve my domain name issue but you have to get registered as a nameserver with your host and everything plus I'm on a dynamic IP. But if anyone has had any experience with BIND, nameserver and dynamic IP setup any pointers would be appreciated.
0
Comment
Question by:Newt6398
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
oobayly earned 500 total points
ID: 24121532
It's been a while since I've set up a web-forwarding domain with Fasthosts, but I'm not quite following your setup.

Ideally, you should have your a CNAME record for www.mydomain.com pointing to mydomain.dynds.org, which is updated by your router.
This way the browser doesn't even know about the dyndns.org domain, as it's only used for resolving the IP. Hence your ASP.Net site would only be concerned with one Host header, www.mydomain.com, and any of the resulting problems should be there anymore.

Personally I'd recommend createing a ZoneEdit account, change the NameServer records for your domain to point to ZoneEdit's ones. Then in ZoneEdit, add a CNAME record that points to mydomain.dyndns.org

The only thing I'll say is, have a good look at your current MX records, so that they can be duplicated when you set up a ZoneEdit account.

This is the way google do theirs, you never see your browser mentioning www.l.google.com
dig +short -t cname www.google.com
www.l.google.com.

dig +short  www.l.google.com
209.85.229.99
209.85.229.103
209.85.229.147
209.85.229.104
0
 
LVL 1

Author Comment

by:Newt6398
ID: 24123535
On zone edit I can only create a numeric A record so I can't point to myname.dyndns.com. So i'm still stuck with web forwarding using a cloaked address.

There must be a way to detect in my Global.aspx the cloaked domain name and then append the sub directory to it.
0
 
LVL 1

Author Comment

by:Newt6398
ID: 24124407
oobayly, thanks, you are absolutely right, I had a redirect going on from my default site in IIS which I totally fogot about. This was causing issues.

Thanks anyhow.
0
 
LVL 15

Expert Comment

by:oobayly
ID: 24124954
Thanks for the points, I'd written another reply,  but somehow left it in a tab and forgot to submit it.

Anyhow, if you ever need to rewrite url, you can use HttpContext.Current.RewritePath() in the Application_BeginRequest event (you may of course know about the one).
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question