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 4570176
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:19:28+00:00 2026-05-21T19:19:28+00:00

On my asp.net mvc page I need to render multiple images that are stored

  • 0

On my asp.net mvc page I need to render multiple images that are stored on third-party images hosting service. The service has some api which returns me a list of image urls.
In *.cshtml file a have the fallowing html markup:

@foreach (var img in Model.Images)
{
   <img src="@img.ImageUrl" />
}

It’s works perfectly. But for some reason I can’t use direct URL to the image in the “src” attribute. Next, I have created new async controller that should return an image:

public class ImagesController : AsyncController
    {
        //
        // GET: /Images/
        public void GetImageAsync(string url)
        {
            AsyncManager.OutstandingOperations.Increment();
            WebRequest request = WebRequest.Create(url);
            WebResponse response = request.GetResponse();
            AsyncManager.Parameters["response"] = response;
            AsyncManager.OutstandingOperations.Decrement();
        }

        public FileResult GetImageCompleted(WebResponse response)
        {
            return base.File(response.GetResponseStream(), response.ContentType);
        }

    }

Now I need to pass a full image url to my controller action.

Something like this:

@foreach (var img in Model.Images)
    {
       <img src="Images/GetImage/**@img.ImageUrl**" />
    }

how to create a new route for passing this parameter to action?

Thanks!

  • 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-21T19:19:29+00:00Added an answer on May 21, 2026 at 7:19 pm

    You mean this?

    routes.MapRoute(
        "GetImage",
        "Images/GetImage/{*url}",
        new { controller = "Images", action = "GetImageAsync" }
    );
    

    I’m not sure why you need all that though. An AsyncController + routing in order to fetch all image url’s seems to be overkill…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display images on my ASP.NET MVC page that will be stored
I need to instantiate some ASP LinkButtons onto an ASP.NET MVC view page. I've
I have an asp.net mvc 2 app. I need to display the same page
i am using asp.net mvc 3. in one my of page. i need to
I am using FckEditor in Create.aspx page in asp.net mvc application. Since I need
I have an ASP.NET MVC page with multiple file uploads. After a failed post,
I have an ASP.NET MVC Page that i have to display the fields in
In my ASP.NET MVC project i need to select all text boxes that have
I have a silverlight control on my asp.net mvc page, need to communicate with
Background: I am working on an ASP.NET MVC app that has 3 partials (based

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.