URL "Prettifying" and Encryption
When starting a web interview, we normally need links like this:
This has two main drawbacks:
- It isn’t very elegant to look at.
- People can add/remove/modify parameters.
Both issues have been addressed:
- We added ‘pretty’ links.
- It’s possible to encrypt links.
To start an interview, you can now use a link like this:
You have to admit this looks much nicer, yes?!
If post/redirect/get is enabled (this option can be selected while installing WebProd), you’ll also have a "pretty" link visible in the location bar while the interview is in progress. It will look like this:
Instead of this:
Here’s the full list of available links to start an interview:
You’ll see that all links looks the same – the only way to see which link type is used is the number of parameters. Note that it is still possible to add additional parameters. You’ll just lose some of the prettiness:
To prevent users from messing around with the links, you can choose to distribute encrypted links instead of clear text links. An added benefit is that these encrypted links are that they also quite a bit shorter than the original links. That’s because known parts (like Action=StartSurvey) are replaced by placeholders.
This link for example:
Would be encrypted to something like this:
A DoExternalPanel link (which is normally quite long) will also be quite a bit shorter. This link for example:
Will become something like this:
Extra parameters are also possible, but of course the encrypted link then gets a bit longer.
Will become something like this:
Encrypting a URL
To get an encrypted URL you can use AskiaExt, using the Action=EncryptLink, and the parameters (the part after the question mark) as the ‘link’ parameter.
Here is an example:
You will get a plain text encrypted value back like this:
To use this in a link you have to include the prefix yourself (including a ~ to indicate this is an encrypted link). So in our case we have to start each link with http://askia.com/WebProd/~
Note that you have to URL-encode the link parameter.
So instead of using:
You have to use:
It’s also possible to use a ‘pretty’ version of this command which doesn’t require URL encoding:
. . . will also return the encrypted value.
Enabling this is optional and not difficult at all.
All this functionality is provided by an embedded ISAPI filter, which allows us to intercept and change URL requests. Enabling this is as easy as installing the ISAPI filter.
- In IIS Manager, go to the Website’s configuration (not the server configuration).
- Open the ISAPI Filters item (by double-clicking it).
- Click on ‘add’ in the right-hand menu:
- Enter a name and the path to AskiaExt.dll:
- When you click ‘OK’, you should be done! No IISReset or application pool refresh is necessary.
- You can use the original links, pretty links and encrypted links concurrently.
- When you install the ISAPI filter (and post/redirect/get is enabled) the browser will always contain the pretty URL once the interview is started (…/WebProd/Interview/JDJSJJSDJ…). You can still start/resume new interviews using all three link types.
- When post/redirect/get is disabled and you start an interview using a pretty link, the browser will show a non-pretty link once the interview is started.
- Even if an interview is started with an encrypted link, once an interview is started you’ll always see either a pretty link or a regular link. We could implement encryption of this link as well if necessary.
- You can get an error while encrypting a link if the link to encrypt has a length greater than 260 characters. It's because the Http.sys service is coded with default maximum of 260 characters per URL segment. The solution here is to add a regkey on the WebProd server. Key to add:
Data: Desired amount. (Max Value is 32766)
You will need to restart the PC once you have added this key.