Ysehporp
Ysehporp
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Amazing!!! Thanks so much!!!
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Hmmm... I'll look into it a bit more and bring that up at my next meeting as well. Thanks so much for all the help, I really appreciate it. It's so hard to find good advice for this on the internet because .net stuff has changed so much over time. You're a life saver
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
using Microsoft.EntityFrameworkCore;
using SMPBackEndAPI.Controllers;
using SMPBackEndAPI.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(builder => { builder.WithOrigins("*").WithMethods("POST").WithHeaders("*"); });
});

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
/*builder.Services.AddDbContext<MessageContext>(
o => o.UseNpgsql(builder.Configuration.GetConnectionString("SMPDB")));
*/
builder.Services.AddDbContext<MessageContext>(
o => o.UseNpgsql(builder.Configuration.GetConnectionString("SMPDB")));

var app = builder.Build();


//// middlewares
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpLogging();
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthorization();


app.MapControllers();
app.Seed();
app.Run();
using Microsoft.EntityFrameworkCore;
using SMPBackEndAPI.Controllers;
using SMPBackEndAPI.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(builder => { builder.WithOrigins("*").WithMethods("POST").WithHeaders("*"); });
});

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
/*builder.Services.AddDbContext<MessageContext>(
o => o.UseNpgsql(builder.Configuration.GetConnectionString("SMPDB")));
*/
builder.Services.AddDbContext<MessageContext>(
o => o.UseNpgsql(builder.Configuration.GetConnectionString("SMPDB")));

var app = builder.Build();


//// middlewares
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpLogging();
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthorization();


app.MapControllers();
app.Seed();
app.Run();
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Sure lemme grab it, this is just a long term project for college so
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Getting things seriallized properly was a headache a few months ago and I don't remember everything we did to sort it out
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
hmmm maybe I have cause looking at my response it seems to be received as just json
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Its a miracle it works rn...
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Wow thats a blunder
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
@.@
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
weiiird we had some issues with that which is why we switched to doing it this way. Tho i wouldn't put it past something having been wrong in the front end when we tried it notLikeMokoko2
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
err autmoatically i mean
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
will that manually seriallize it into json?
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Oh hmmm I see
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
As far as the manual serialization goes its because my front end dev wants to do some weird stuff
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Thank you so much!!! NotFound exists now and I can get it
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
Aha! Okay, yes my issue was with the controller base being an ambigious reference because of another solution I attempted earlier
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
I will take this into consideration and bring this up with my group at the next meeting
54 replies
CC#
Created by Ysehporp on 3/26/2023 in #help
✅ Sending an HTTP Exception in Web API
54 replies
CC#
Created by Ysehporp on 3/17/2023 in #help
❔ Encoding Confusion and string variables
They aren't. It's just something passed between two users to identify each other. Their actual account passwords are stored properly hashed and salted, but for reasons they need to be able to pass a string to eachother which is encrypted like this
6 replies
CC#
Created by Ysehporp on 3/17/2023 in #help
❔ Encoding Confusion and string variables
I solved this but I'll leave this here undeleted in case anyone else ever searches for something similar. Essentially the problem is that Encoding.GetString doesn't preserve the original bytes perfectly if they contain non-ascii characters. In my case they do. Convert.ToBase64String and Convert.FromBase64String do preserve the original bytes
6 replies