Avatar of lulu50
Flag for United States of America

asked on 

Not to hard code the path to a link


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

.NET MVC* ASP .NET MVC 5.NET ProgrammingC#

Avatar of undefined
Last Comment

8/22/2022 - Mon