PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WB21] - Domain names in websites
[WB21] - Domain names in websites
Débuté par JP, 09 oct. 2017 15:00 - 14 réponses
Posté le 09 octobre 2017 - 15:00
HI All,

Sorry for the poor post title but not sure how to title it. Here is the question:

Using WebDev 21 n Windows Server 2008 and IIS7

I have a website which I developed as www.mydomain.com. If I visit this domain all works perfectly. If I visit this site and not use the "www" prefix then the site loads but various links and buttons do nothing or appear to not function like loading a page in a frame.

Is this a known issue or is this a design development issue I can address some how?

Thanks
Posté le 09 octobre 2017 - 15:31
Hi JP

AFAIK, this is a DNS/Web server configuration problem (ie the domain name without the www does not 'POINT' to the right place)...

Nothing to do with your web site in itself.

Best regards
Posté le 09 octobre 2017 - 15:56
Fabrice

Thanks but its not that. I have set the DNS pointing both www.mydomain.com and just mydomain.com to my website. Using either one does land me on my homepage and the site loads apparently correctly. And links inside the main frame work OK.

But when I click a link that loads a page in a frame on the main page then it does not load if I am using the domain name without the "www" prefix. Somehow it only works if I land on the domain with the "www" prefix.It is as if this "www" is somehow hardcoded into the site itself?
Posté le 09 octobre 2017 - 19:52
Hi

you are talking only about the DNS part of my answer...

You seem to completely ignore the web server settings part (virtual directory, if I remember correctly)

Now, if you were able to isolate the problem to some specific code of yours, and you are NOT showing us said code, we cannot help.
Posté le 10 octobre 2017 - 08:04
Hi Fabrice

I'm not sure what you mean by the web server settings "virtual directory" question but here is more info.

The website is really a simple one as follows with additional notes:

1) The landing page has 4 zones; top, bottom, left-hand navigation options, and right-hand content display.

2) The right-hand side zone has an iFrame on it which I use to send requested pages to for display.

3) Using either the "www" prefix or not the website initially loads fine. No problem here.

4) The user can enter login details in the right-hand zone and that works fine.

5) Other functionality which all exist in the right-hand zone work fine like registering for a login or asking for a reminder email.

6) Once logged in a user can choose what to view by choosing options displayed in the left-hand navigation zone.

7) The option chosen in the left-hand navigation zone uses a hidden (off-screen) button to load the requested page into the iFrame in the right-hand zone. The button description has its destination set to the iFrame existing on the right-hand zone.

7.1) The button code uses PageDisplay() to load the page requested.

Step 7 works if I access the site including the "www." prefix to the domain name. It does nothing if I leave off the prefix; no error or anything - just appears to do nothing. This is the point of failure.

Any suggestions of what I am doing wrong?

TIA
Posté le 10 octobre 2017 - 13:49
Hi again

nothing in there should have ANY bearing on your problem..

If one url works and not the other, then the problem is at the URL management level, NOT inside your site.

So, again, the problem should be at the virtual directory level in our web server configuration (IIS or Apache).

As you do not seem to understand what I'm talking about, I'm going to do a quick and dirty description of the process hapenning when you type a URL in a browser:

- you type htttp://mydomain.com or http://www.mydomain.com, or simply mydomain .com or...
- your internet box is configured to ask a DNS for the corresponding IP, so DNS should be set correctly for the URL both with and without www
- once it gets the IP address, it uses it to contact port 80 or 443 (http/https) on your server
- there, the WEB Server is listening (IIS or Apache)
- Because a web server can host MANY web site, it now needs to REDIRECT the request to the correct one
- for that, it uses a system of virtual directory, where an external URL matches an internal directory/CGI engine (webdev in your case, for a specific site)...

It's at this level that BOTH the url WITH and WITHOUT www needs to be redirected to the exact same place. However, I've seen often that only ONE of them is setup automatically.

I'm not sure of the reason why, but maybe it's because it is possible at the DNS level to redirect mydomain.com to www.mydomain.com (or the contrary), so that all users see the same thing in the address bar, so it's not mandatory to have both at the virtual directory level.

Anyway, either you need to correct the DNS settings, or you need to correct your Web SERVER settings. If the whole chain is not correct, then one of your url is not pointing to the right thing, and you get this kind of problems.

And if you don't know what you are doing at this level, then you need a web server administrator to set things up for you.

Best regards
Posté le 10 octobre 2017 - 15:49
Hi Fabrice

IIS7 is definitely set up correctly in so far as all domain name variations are pointing to the same website - otherwise the website would not load when I use one of the other domain name variation. Under IIS, under "bindings", I have set all the domain name variations / virtual directories. With/without domain prefix the site loads fine. And all functionality works fine except this one thing that I tried to describe prior post. I have used this IIS bindings to route several domain name variations to a single domain and this always works fine albeit I have not done this with WebDev sites before.

It is difficult to describe but I will try again in case anyone can spot the mistake.

In the left-hand zone is a table. The table is populated with some names. When the table row is clicked the browser click code excutes and that in turn fires the click event of a button hidden off-screen using the ExecuteProcess() function. That button's click code loads the requested page using a PageDisplay() function call.

Why do I need to do the above merry-go-round? Because I found that relying on the table row click often gave the wrong row number especially when testing under Internet Explorer (I did post these issues on this forum so I wont repeat it all again). The above method, Table Row Click firing the Button Click method works correctly and gets the correct table row each time under all tested browsers.

I have now narrowed down the problem to a specific point and hopefully this rings a bell with someone. The button has browser click code and server click code (non-Ajax). When I load the site using the "www." prefix both the browser click code and the server click code will execute. When I load the site without the "www." prefix only the browser click code executes.

I think that somewhere there is a setting in WebDev or the WebDev Admin console that I need to adjust.

Anyone who wants to give this a go and charge me for the time spent can email me private message me and give me an estimate on cost.

TIA
Posté le 11 octobre 2017 - 08:47
Hi All

So I have found something more specific:

If I access my site using the "www." prefix to the domain name then both the button browser code and button server code executes and all is well.

If I access my site and not use the "www." prefix to the domain name then if the browser code contains any function which requests something of the browser, such as PageExist(), then the browser click code executes but then the server code does not execute and thus the page I want does not load.Commenting out these Page-type functions or similar browser functions and everything works correctly and the button server code executes properly. Any other kind of code like a Loop or a Switch or whatever also executes fine - just no functions which seem to request or interrogate the browser.

Any ideas?
Posté le 11 octobre 2017 - 11:11
Hi JP,

Thanks for bringing this up... I think I've learnt something new with this article:

http://www.themezilla.com/should-you-use-www-in-your-url-or-not/
Posté le 11 octobre 2017 - 11:23
Hi JP,

Some browsers are very persistent in using a cache, so you may want to clear your browser cache.
Is your site AWP?

Kind regards,
Piet
Posté le 11 octobre 2017 - 12:48
Hi Piet,

Yes, cache is clear. I literally switch between with-prefix and without prefix and make the problem repeat anytime. I just have this nagging feeling that somewhere in WebDev there is a reference to "www." but search finds nothing like that. And it defintely only happens if the browser button click code contains any kind of PageXXX() function which obviously is referencing the browser. I suspect that an error is occuring but not displayed ... not sure where to find that. Maybe the site logs...?
Posté le 11 octobre 2017 - 13:50
Darren,

Thanks for th article link. It is interesting what they write - we have always used the "www" prefix but someone recently tried accessing the site without it and this issue cropped up.

I can solve it by setting up a dummy IIS site to receive the non-www domain and simply directly re-route that request to the with-www domain but that seems so much work for what I think is a setting, or my code error, or something else in WebDev because literally everything else works except this. And even if I replace the button with a hyperlink control the exact same issue happens - if the hyperlink control contains any PageXXXX() function or similar browser interrogating function then the server code does not execute. I need to see if an error is occuring which might give me a clue ...
Posté le 11 octobre 2017 - 14:15
Some more on this mystery;

The button browser click code hs this code in it:

SWITCH True CASE PageExist( PAGE_Series_Company ) PAGE_Series_Company.IMG_Series_Page_Loading_Animation..Visible = True CASE PageExist( PAGE_Series_Director ) PAGE_Series_Director.IMG_Series_Page_Loading_Animation..Visible = True OTHER CASE END
If I access the site with the "www" prefix to the domain this works. If I access the site without the "www" prefix this fails. If I encapsulate this code in a WHEN EXCEPTION or use the built in CODE EXCEPTION: feature of WebDev then WebDev clearly hits an error but otherwise continues properly ! Therefore, this code causes an exception or other type error when running the site without the "www" prefix.

So my question is this: how can I see what the exception is from within the button's browser click code? ErrorInfo() is server side function only.
Posté le 11 octobre 2017 - 15:10
Hi

in order to see what's happening in the browser code, use F12 to access the browser developper console. You will get the JS error that MAY give you a hint...

Of course, and as stated in one of my previous answers, you can simply work around the problem by setting a DNS redirection in 5 mns so that any call to mydomain.com is redirected to www.mydomain.com AT THE DNS level (no need to setup any web site/change anything in the IIS settings).

Best regards
Posté le 11 octobre 2017 - 16:14
Hi Fabrice,

Thanks for the F12 - will check that.

iro DNS solution to this - yes, I can, but to me I would like to know what this issue is so that I can understand it. Doing the DNS thing just treats a symptom :)