Mihneas22
Mihneas22
CC#
Created by Mihneas22 on 2/23/2025 in #help
✅ Image Postman
No description
20 replies
CC#
Created by Mihneas22 on 2/23/2025 in #help
✅ AWS S3 with ASP.NET Core
Hello! So I have this code here for a minimal API that returns an image file from a S3 Bucket: app.MapGet("images/{key}", async (string key, IAmazonS3 s3Client, IOptions<S3Settings> s3Settings) => { var getRequest = new GetObjectRequest { BucketName = s3Settings.Value.BucketName, Key = $"images/{key}" }; var response = await s3Client.GetObjectAsync(getRequest); return Results.File(response.ResponseStream, response.Headers.ContentType, response.Metadata["file-name"]); }); What I want is to make this minimal api request into a normal one, like this here: public async Task<ImageResponse> GetImageAsync(string fileName) { var getRequest = new GetObjectRequest { BucketName = settings.Value.BucketName, Key = $"images/{fileName}" }; var response = await amazonS3.GetObjectAsync(getRequest); return new ImageResponse(response.ResponseStream, response.Headers.ContentType, response.Metadata["file-name"]); } My error is that I cant return the same type (in the first it is Results.File) and in the second I can't use the same and I am being forced to make a custom one. The thing is, with the second option, I get an error with "HashStream does not support seeking". How am I supposed tot deal with this?
14 replies
CC#
Created by Mihneas22 on 2/2/2025 in #help
Storing and displaying images
Hello! I have a blazor web app with an Asp.Net Core API and a SQL Server Db. I want to store images in my database as varbinary(max) datatype and i want to insert them and read them whenever I want in my website. But I can't find any meaningful resources that explain how to do that. Can anyone help or give some advice? Thx
8 replies
CC#
Created by Mihneas22 on 12/20/2024 in #help
Hosting an API
Hello! I want to host my API to the web but I don't rlly know what service to use. I have an ASP.NET Core API, Clean Arhitecture with a local SQL Server Database. What would be the best method to get it on the web along with the database? Thanks!
43 replies
CC#
Created by Mihneas22 on 12/20/2024 in #help
Database In ASP.Net Core
Hello! So basically we all know when we create a SQL Database in Visual Studio Community with EF and SQLServer and we can store data there. My question is this: when we add the app to a website like Heroku or a Hosting App in order to publish it to the web, does the database with all the data gets added too or is there a separate process for that? Thanks!
60 replies
CC#
Created by Mihneas22 on 12/19/2024 in #help
RapidApi
Hello! I was thinking of starting to use RapidAPI to sell some API's. Is anyone here using RapidAPI that would like to talk to me about this platform? I have some questions about it Thank you!
1 replies
CC#
Created by Mihneas22 on 12/9/2024 in #help
Get values from appsettings in .NET Core
Hello, I have this function in which I try to get a value from app settings file with the IConfiguration but it seems the method I got to use doesen't exist in this current context. How can I solve? private readonly IConfiguration _configuration; public APIKeyValidation(IConfiguration configuration) { _configuration = configuration; } public bool ValidateKey(string userApiKey) { if (userApiKey == null) return false; var apiKey = _configuration.GetValue<string>(ApiConstants.ApiKeyName); if(apiKey == null || userApiKey != apiKey) return false; }
8 replies