troubleshooting Question

Not to hard code the path to a link

Avatar of lulu50
lulu50Flag for United States of America asked on
.NET MVC* ASP .NET MVC 5.NET ProgrammingC#
1 Comment1 Solution41 ViewsLast Modified:

I need your help please

How can I change my code not to have a path in my code.

instead of this '/bcwa/CareAdvanceBusinessRules/'

I want something like this but it doesn't work.

'@Url.Action("ExportToExcel", "CareAdvanceBusinessRules")';

the problem that I have is when I upload my document to the server.
the server has a different path than my local document so I have to manual change the path every time I need to do an upload.

How can I remove the hard code path from my code and replace it with something else?

    function ExportToExcel() {


        $('#SearchRulesForm').attr('action', '/bcwa/CareAdvanceBusinessRules/ExportToExcel');



Open in new window

Web application

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros