Link to home
Start Free TrialLog in
Avatar of Moti Mashiah
Moti MashiahFlag for Canada

asked on

asp.net mvc & js

Hi guys,
I am using asp.net mvc 5 and I have one controller that initiate the first page.
something like this:
http://localhost:60219/documentviewer/index.

Now I am calling a service from serviceConfig.json. which look like this:
{
   "_comment_": "This file is used if an external application needs to change the values the client application will use to communicate with the service.",

   "licenseDirectory": null,

   "serviceHost": "http://localhost:60219/",
   "servicePath": "",
   "serviceApiPath": "api/",

   "app3": "",
   "app4": "",

   "GoogleDriveLoad_ClientID": "",
   "GoogleDriveLoad_APIKey": ""
}

Open in new window


when I call this json file I am trying to get this link
http://localhost:60219/api/test, but instead I am getting - http://localhost:60219/documentviewer/index/api/test

my question is: how can I get read of the controller and view from the first page and return just -http://localhost:60219/api/test


Thank you.
Avatar of Misha
Misha
Flag of Russian Federation image

Usually you go to the pass: "localhos***/YourControllerName/YourControllerMethodName"
Sometimes you can pass parameters to the server.
If you want to redirect to another link from your controller, you can use this code:
return Redirect("http://www.google.com");

Open in new window

If you want to redirect to another controller (api), you can use this code, because the default route is
{controller}/{action}/{id}

Open in new window

return RedirectToAction("test","api");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Moti Mashiah
Moti Mashiah
Flag of Canada 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 Moti Mashiah

ASKER

Sorry Misha your answer is not related to my case, but thanks for trying to help.
fixed