Asp.net imageurl hatası

scorpionsx

Hectopat
Katılım
20 Mayıs 2022
Mesajlar
96
Daha fazla  
Cinsiyet
Kadın
Merhaba asp.net ile proje yapıyorum sayfa yüklenirken resimler yüklenmiyor. Sayfada JPEG diye yazıyor ama uygulamada JPG ile yazdım. Sebebini anlayamadım.
 

Dosya Ekleri

  • Ekran görüntüsü 2023-10-21 114143.png
    Ekran görüntüsü 2023-10-21 114143.png
    126,8 KB · Görüntüleme: 45
  • Ekran görüntüsü 2023-10-21 114205.png
    Ekran görüntüsü 2023-10-21 114205.png
    151,1 KB · Görüntüleme: 34
Son düzenleyen: Moderatör:
Server mappath komutunu mu kullandın? Asp.net view engine tarafındaki kodlarıda atar mısın?
 
Server mappath komutunu mu kullandın? Asp.net view engine tarafındaki kodlarıda atar mısın?
wwwroot kullandım image için.

Kod:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using shopapp.data.Concrete.EfCore;
using shopapp.data.Abstract;
using shopapp.business.Abstract;
using shopapp.business.Concrete;
namespace shopapp.webui
{
    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<IProductRepository, EfCoreProductRepository>();
            services.AddScoped<IProductService, ProductManager>();
            //mvc
            //razor pages
            services.AddControllersWithViews();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseStaticFiles(); //wwwroot

            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(
                     Path.Combine(Directory.GetCurrentDirectory(), "node_modules")),
                RequestPath = "/modules"
            });


            if (env.IsDevelopment())
            {
                SeedDatabase.Seed();
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            //localhost:5000
            //localhost:5000/home
            //localhost:5000/products
            //localhost:5000/category/5
            //localhost:5000/products/list/2

            //Aşağıdaki şemaya göre gelen istekleri değerlendirebiliyoruz. Bir controllerın birden fazla actionı olabilir.

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"

                );
            });
        }
    }
}
 

Technopat Haberler

Yeni konular

Geri
Yukarı