Jeremy Villa
Jeremy Villa

Reputation: 169

c# mvc why are urls combining when requested?

This is my first time developing something in C# and in MVC. I deployed my application and everything seems to be functioning ok except for the navigation. The first thing you click on will direct you properly, but the second time will try to combine the pathing request with the first.

Ex. Clicking on Services drop down and click ProcessReports correctly returns the web page, with the URL:

http://{ServerName}/SupportPortal/Support/ProcessReports

Then, clicking on a dropdown and then DalimWebApp Dev returns a 404 error and the url is

http://{ServerName}/SupportPortal/Support/Support/DalimWebApp/Dev

Why are there two "Supports?" Any ideas?

Upvotes: 0

Views: 38

Answers (1)

Babak Naffas
Babak Naffas

Reputation: 12581

How are you generating the URL for your links?

If you're using an HTML anchor with an href value "Support/ProcessReports" instead of "/Support/ProcessReports" (mind the forward slash) the URLs will be relative to your current path. Try prepending the forward slash.

As @David mentioned, you could also use the built in helpers to generate the entire link for you if it's easier for you.

Upvotes: 1

Related Questions