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

  • SEARCH
  • Home
  • 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 7723745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:31:09+00:00 2026-06-01T04:31:09+00:00

My controller returns a string which is a url of an image of an

  • 0

My controller returns a string which is a url of an image of an external site.
How do I display that url on the view.
I appreciate your help.

  • 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-06-01T04:31:10+00:00Added an answer on June 1, 2026 at 4:31 am

    AngryHacker is correct. I am just expanding AngryHacker’s answer with some code example.

    Add a property in your ViewModel for the image url and return it in the first get call. Then use it in the View. Thus you are avoiding an unnecessary http request to to the action again

    public class UserProfileViewModel
    {
      public string DisplayName { set;get;}
      public string GravatarURL { set;get;}
    }
    

    and in your ACtionMethod,

    public ActionResult Get(int id)
    {
      UserProfileViewModel objVm=new UserProfileViewModel();
      objVM.GravatarURL="http://www.externalsite.com/image/tiyra.jog";
      //Set other properties also.
    
      return View(objVm);
    }
    

    and in the View which is strongly typed to your UserProfileViewModel,

    @model UserProfileViewModel
    <h2>"@Model.DisplayName </h2>
    <img src="@Model.GravatarURL" />
    <p>The image is loaded from @Model.GravatarURL</p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Controller which returns a ViewModel to a View and it works
Hi guys i have controller which returns a partial view, the controller is called
I have the following getJSON that calls an MVC controller which returns inforamtion back:
If i have a controller action Create that returns a view with the following
I have a Spring controller that returns XHTML, what's the easiest way to setup
So if your Controller Action returns a Model with pre-populated values, how do you
I have a controller method that returns a jSON object and in one calling
I need to display in image on the view this way <img src =
I have a view which contains a users id and an image column. Here's
I have my Controller which pass Data from to view as below: IEnumerable<MovieDetails> jsonData

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.