views:

122

answers:

1

I'm building a REST system under IIS/ASP which provides general record listings. But I also want to insert into these general listings a URI which allows the client to retrieve each specific record's details. I've come up with the following JScript to build an URI leader which I can then tack on record specific addressing:

<% @LANGUAGE="javascript" %>
<%
var ScriptUrl = Request.ServerVariables("HTTPS") == 1 ? "https://" : "http://";
ScriptUrl += Request.ServerVariables("HTTP_HOST");
ScriptUrl += Request.ServerVariables("SCRIPT_NAME") + "?";

// Record retrieval...

// Update each record with an absolute URI back into this page...

// Return enhanced listing data...
%>

So if the bulk record listing was requested through a URL like:

https://rest.site.com:12345/default.asp?/records

ScriptUrl would equal https://rest.site.com:12345/default.asp?

Is there a better way to do this under ASP/IIS?

A: 

I think that would work. Are you looking for some specific advice on how to implement it, or just somebody else to reinforce that the method you're picking is valid?

rwmnau
Someone to validate that's "OK." I'm just getting into ASP/IIS and encouragements, or enlightenment on better ways, would be helpful at this stage.
aczarnowski
Then I'd say go for it. I'm interested to know the results, since I've never attempted exactly what you're describing. If you run into any errors, be sure to post them back here and we'll help you work through them. Welcome to the site!
rwmnau