ASP.NET MVC: How to create a usable UrlHelper instance?

前端 未结 4 695
Happy的楠姐
Happy的楠姐 2021-02-13 05:26

I am using quartz.net to schedule regular events within asp.net mvc application.

The scheduled job should call a service layer script that requires a UrlHelper instance

4条回答
  •  北海茫月
    2021-02-13 06:13

    Remember to specify the protocol parameter when using UrlHelper.Action method, this will generate absolute urls. Example:

    url.Action("Action", "Controller", null, "http")
    

    or

    url.Action("Action", "Controller", null, request.Url.Scheme)
    

提交回复
热议问题