troubleshooting Question

Not to hard code the path to a link

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

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() {

        $('#GetAction').val("ExportToExcel");

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

        $('#SearchRulesForm').submit();

    }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
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