Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6996343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:08:39+00:00 2026-05-27T20:08:39+00:00

I have the following code inside my asp.net-mvc project: private string GenerateEmail(RequestContext requestContext) {

  • 0

I have the following code inside my asp.net-mvc project:

private string GenerateEmail(RequestContext requestContext)
{
    var u = new UrlHelper(requestContext);
    string url = u.AbsoluteAction("Detail", "Application", new { id = app.Id });
}

I use the UrlHelper because I want the full url to be put in the emails (not a relative url) and it works great in my mvc project

I now want to be able generate these emails from another solution (which is not web based) so i tried refactoring all of my email code outside of the mvc project but this is the one line I can’t remove (since UrlHelper depends on System.Web.MVC)

what is the best way to factor out this code in a “generic” C# project that doesn’t have a dependency on System.Web.MVC ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:08:39+00:00Added an answer on May 27, 2026 at 8:08 pm

    It´s OK to extract the URL in the ViewController and then pass the URL as a string to the emailer class.

    So if you create the emailer class with a method like the example below, the emailer will be independent of the MVC framework:

    public string GenerateEmailBodyFromUrl(String url)
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
Hallo, I have following jquery code for calling ASP.NET MVC controller method that is
I'm using asp.net with url rewrite . Inside Page Load I have the following
I have the following html (inside ASP.NET Repeater): <div class=team_member> <a class=teamMemberLink href='<%# Profile.aspx?uID=
I have the following HTML code in my ASP.NET application and I want to
In a Symfony project, I have the following php code inside a YML file.
Inside my template function I have the following code: TypeName myFunction() { TypeName result;
I have the following XAML code, which displays a picture (image inside borders) and
I have following code class User attr_accessor :name end u = User.new u.name =
I have implemented errors handling in ASP.NET MVC site in a way like suggests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.