How to access a Json file as an endpoint ?


I am working on a .Net application comnined with Optimizely CRM. i would like to access a json file like

but i can able to accress from local like


but wehen i try to deploy in the test environment i get this error
404 not found

Any help would be highly appricited.

Mar 21, 2022 14:37

Have  you checked if the json file is present in the test environment?

Mar 22, 2022 7:40

I think the most likely reason is, as Tomas suggests, that the file hasn't been deployed for some reason but, if the file is there and you're still getting a 404, it could be an issue with mime type mappings. If you're on .net 4.x, you can add a mapping for the file type in web.config like this:

  <remove fileExtension=".json" />
  <mimeMap fileExtension=".json" mimeType="application/json" />

If you're on .net >= 5, you'll need to add your mapping in your startup class using app.UseStaticFiles.

Mar 22, 2022 9:57
Rashed - Mar 22, 2022 14:43
thanks. this piece of code really worked well.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.