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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:04:34+00:00 2026-06-07T10:04:34+00:00

By other than using AddResource button of Visual Studio, of course. I submit a

  • 0

By other than using AddResource button of Visual Studio, of course.

I submit a form, and an image file with it. In my controller action, I get the HttpPostedFileBase object, and its file name by using Path.GetFileName(). If I just use SaveAs() function to save the image file in my application, I cannot access it later for testing, because it gives me the “Not allowed to load local resource” error.

So I want to add the image to a .resx file and retrieve it later using ResourceManager or something. My question is, how can I add the image I have in the controller action into my .resx file?

I should also ask if this is the good approach for the purpose of adding and retrieving image files in my application.

EDITED:
Ok, using .resx to store images is not a good idea. My original problem was that I could save the image file, but when I tried to show it in my view, it gives “Not allowed to load local resource” error.

Here’s the controller code:

public ActionResult UrunEkle(Urun urun, HttpPostedFileBase image)
{
    Directory.CreateDirectory(Server.MapPath("~/App_Data/Images"));
    var path = Path.Combine(Server.MapPath("~/App_Data/Images"), fileName);
    image.SaveAs(path);  

    urun.ArtUrl = path;

    // other stuff....
}

And in my view, I try to retrieve the image like this:

<img alt="@urun.name" src="@Url.Content(urun.ArtUrl)" />

But using Google Chrome, I get this “Not allowed to load local resource”. How can I avoid this?

  • 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-07T10:04:36+00:00Added an answer on June 7, 2026 at 10:04 am

    Forget trying to add the image to a RESX file; it’s not designed to be modified at runtime.

    Please post some code. The most likely thing is that the URL that you’re serving up to use the image later is incorrect. Probably because you’re returning the path of the file on the server, not a URL to the image within the context of the web site.

    The error message from Chrome is telling you that it’s trying to load a resource from the local file system on the client.

    Url.Content converts a relative virtual path into an absolute virtual path and needs a URL starting with ~. You’re currently passing in the absolute physical path to the image file and Url.Content is returning it, unchanged. You need the relative virtual path (~/App_Data/Images/Untitled.png) in urun.ArtUrl. This is the value that you passed in to Server.MapPath.

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

Sidebar

Related Questions

Other than using browser,How can I get the public key of a websites which
Is there a way to hide cursor (other than using transparent image as a
Is any other way to get the slected folder path other than using fileupload
how to get uiimage from a nsurl other than using the method NSData *data
Other than using listeners, is there any way by which i can get index
Other than using the Column chart and naming appropriately is it possible to create
Is there any way to install C# libraries other than using the Package Manager
Other than reading the GetFileName() file and reading to line GetFileLineNumber() of a stackframe
Other than the fact that PNG is a more common image format, is there
Is there a way to convert a byte array to string other than using

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.