Using Ajile with ASP.NET and default documents.
We are using Ajile and have hit upon a problem using it with ASP.NET
in it's default configuration.
If one is using the standard IIS "default document" then the default
document is default.aspx.
Thus a reference to http://mysite.com/ is really a reference to
Ajile appears to assume that it's a reference to *index.htm* and
therefore looks for index.js rather than default.js.
Is there any chance of a new option to specify what the default
Changing our default document would be painful at this point because
of the large number of users with bookmarked references.
Thanks for all the great work!
- Hi Mark,
The short answer is that Ajile can already handle this, you'll just have
to give it a little help ;-)
The long answer is that Ajile treats default pages as a special case and
is intentionally designed to always load index.js even if your server's
default page is default.aspx as is the case with ASP.NET. For a little
background on this read this thread
Now, back to the short answer. Yes, Ajile will need a little help, but
just what kind of help? If you read the linked thread above you should
have some idea, if not, here's the answer:
Step 1: Copy your existing default.js and rename the copy to
Step 2: Confirm that you now have both an index.js and a
default.js in your directory and both share the same content.
Step 3: Stand proud and proclaim your greatness, for you've just
saved the day :-)
So why does that work? Read on:
When a site is loaded using the server's default page mechanism ( i.e.
http://www.mysite.com/ ) Ajile has no 100% reliable cross-browser way to
automatically detect what resource the server has assigned to respond to
such default page requests. Ajile needed to account for the infinite
number of default page possibilities while remaining compact and
relatively simple to use. As a result I decided that the solution
1. Be as unobtrusive and decoupled as I could imagine.
2. Avoid unreasonably forcing developers to change their server's
3. Function as expected regardless of the host server or
environment's default configuration.
By providing both a default.js and an index.js you allow Ajile to
effectively respond to both default and explicit page requests:
1. A request for http://www.mysite.com/ will load index.js
2. A request for http://www.mysite.com/default.aspx will load
Since both the default.js and index.js contain the same content the end
result is indistinguishable. You also have the option to have one of the
two files load the other:
If disk space is a concern and it's unlikely that default.aspx will be
explicitly requested, the Load technique may be preferred. Using this
technique the default.js file will be trivially small and the additional
server request for index.js will occur infrequently since most default
loading should directly load index.js. You an switch which file loads
the other so it best fits your scenario. It's your choice to determine
which approach is most acceptable/effective.
If you've read this far, you should now have a useful answer to your
question and a better understanding of the solution and why it works. If
not definitely let me know.
P.S. A load-time/runtime option is still a possibility, but the list of
such options is growing and it's becoming more necessary for me to
balance overusing the option concept with implementing the most
effective solution. In addition a new option would require developers to
learn yet another piece of information and introduces new possibilities
for user error, for example:
1. The default option is used, then the server's configuration is
changed to not load default.*
2. The default option is used, then the server type changes
(ASP.Net -> JSP|PHP, etc.)
3. The default option is used, but it's missed typed.
The option idea isn't off the roadmap, but it needs a bit more
justification. Your posting is causing me to seriously reconsider it,
--- In firstname.lastname@example.org, "markat2" <markat2@...> wrote:
> We are using Ajile and have hit upon a problem using it with ASP.NET
> in it's default configuration.
> If one is using the standard IIS "default document" then the default
> document is default.aspx.
> Thus a reference to http://mysite.com/ is really a reference to
> Ajile appears to assume that it's a reference to *index.htm* and
> therefore looks for index.js rather than default.js.
> Is there any chance of a new option to specify what the default
> document is?
> Changing our default document would be painful at this point because
> of the large number of users with bookmarked references.
> Thanks for all the great work!
[Non-text portions of this message have been removed]
- Thanks for the comprehensive reply Michael, we'll certainly consider
adding the extra JS file as an option.
As I see it the main downside to that approach is the extra round-trip
to the server for every page request (OK it might be cached but often
it won't be).
We try to minimize the number of round-trips as we already seem to have
quite a few so please do consider the option!
Thanks again and keep up the good work
- Hi Mark,
Just to clarify, there is no extra round-trip to the server when using
the extra JS file option.
If all you did was create a copy of your default.js and renamed it to
index.js Ajile will only make one request. Ajile determines which file
(index.js / default.js) to load at runtime and will always only
request one, never both. This is all you need to do to solve the
default page issue and you won't incur any additional server calls
using this approach.
The extra round-trip you mention would only occur if in addition to
copying and renaming the default.js file you also changed default.js'
content such that all it did was load index.js (i.e. Load("index.js");
). You would presumably only use this technique for disk space
savings, it's not required to handle the default page issue and was
mentioned only as an alternative to the basic solution of simply
duplicating the default.js and renaming it to index.js.
Hope that helps to clear up any confusion...
--- In email@example.com, "markat2" <markat2@...> wrote:
> Thanks for the comprehensive reply Michael, we'll certainly consider
> adding the extra JS file as an option.
> As I see it the main downside to that approach is the extra round-trip
> to the server for every page request (OK it might be cached but often
> it won't be).
> We try to minimize the number of round-trips as we already seem to have
> quite a few so please do consider the option!
> Thanks again and keep up the good work
- Yes, I'm afraid I discounted the duplicate-the-file option as most
likely to lead to a nightmare of recriminations amongst the team as to
who updated which file most recently, either that or non-standard
deployment code to copy one over the other as part of deployment.
--- In firstname.lastname@example.org, "mikeizworkin" <mikeizworkin@...> wrote:
> The extra round-trip you mention would only occur if in addition to
> copying and renaming the default.js file you also changed default.js'
> content such that all it did was load index.js (i.e. Load("index.js");