Shawn Mclean
Shawn Mclean

Reputation: 57469

Get current web host and app directory from class library

I want to send an email confirmation from my service layer (class library). This can be triggered from an asp.net mvc controller or a wcf service.

How do I build the Url from the service layer?

Upvotes: 1

Views: 1070

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

The service layer shouldn't have knowledge of how urls are constructed in your web application, especially because those rules can easily change. Also this makes your service layer tightly coupled to the web layer and less reusable. What if tomorrow you wanted to reuse this service layer in a desktop application?

IMHO that's an information that should be passed from the controller to the service layer.

Upvotes: 1

Related Questions