Link to home
Start Free TrialLog in
Avatar of jdana
jdanaFlag for United States of America

asked on

Portion of URL set aside for client JavaScript, what's it called? How do I configure in ASP.NET Web API?

I'm setting up my first Ember.js / ASP.NET Web API combo. I'm at the point where the Ember client and the ASP.NET API are talking to eachother. If I enter the following URL into Chrome, it works.

http://localhost:65296/#/properties/1

With the above URL, IIS Express and ASP.NET Web API are smart enough to ignore the portion of the URL to the right of the hash, they return index.html along with Ember's two ginormous CSS and JS files. The JavaScript under index.html, in turn, is smart enough to look at the path, spit out an XHR request to the API (which includes a path of api/properties/1), and configure itself based on the path properties/1 and the JSON in the HTTP response from the API.

Here's the rub, if I exclude the hash from the URL, IlS and the ASP.NET Web API take a crack at routing properties/1 (w/o the api prefix) and strike out.

http://localhost:65296/properties/1

I need to configure IIS Express / ASP.NET Web API to work without the hash. In other words, unless it sees /api in the path (ex. /api/properties/1), its job is to ignore the path.

Question 1: What is best name for this functionality? "History API"? "Fragment"? "Fragment Identifier"? Something else?
Question 2: I suspect I take care of this with a little bit of default routing in the ASP.NET Web API. Once I get a better handle on the name for this functionality, I'll be able to research the fix in ASP.NET Web API (or possibly IIS Express).
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jdana

ASKER

Thanks!
You are welcome.