Suraj Kumar
Suraj Kumar
CC#
Created by Suraj Kumar on 2/19/2025 in #help
SQL Server Management
Update: I did not installed Sql express. Now it is connected
2 replies
CC#
Created by Suraj Kumar on 8/29/2024 in #help
✅ C# linux
no problem maybe I asked the wrong question
8 replies
CC#
Created by Suraj Kumar on 8/29/2024 in #help
✅ C# linux
since it is not auto importing or referencing like it happens in visual studio
8 replies
CC#
Created by Suraj Kumar on 8/29/2024 in #help
✅ C# linux
No description
8 replies
CC#
Created by Suraj Kumar on 8/23/2024 in #help
✅ Guidance in software development
weekend is here though:when:
26 replies
CC#
Created by Suraj Kumar on 8/23/2024 in #help
✅ Guidance in software development
yeah no issues I have found it in a playlist..
26 replies
CC#
Created by Suraj Kumar on 8/23/2024 in #help
✅ Guidance in software development
Okay, thank you for this🤘
26 replies
CC#
Created by Suraj Kumar on 8/23/2024 in #help
✅ Guidance in software development
IAmTimCorey he have paid courses...refering to his youtube videos will be good to start?
26 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
/closr
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
Thanks for the help. One last question Umbraco uses razor pages but why not blazor?
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
great!
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "AGN3API", Version = "v1" });

option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
builder.Host.UseSerilog((context, configuration) =>
configuration.ReadFrom.Configuration(context.Configuration));

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

//app.UseHttpsRedirection();
app.UseSerilogIngestion();
app.UseSerilogRequestLogging();
app.UseCors("AllowAll");
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();

app.Run();
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "AGN3API", Version = "v1" });

option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
new string[]{}
}
});
});
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
builder.Host.UseSerilog((context, configuration) =>
configuration.ReadFrom.Configuration(context.Configuration));

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

//app.UseHttpsRedirection();
app.UseSerilogIngestion();
app.UseSerilogRequestLogging();
app.UseCors("AllowAll");
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();

app.Run();
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
//Adding Authentication
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})

// Adding Jwt Bearer
.AddJwtBearer(options =>
{
options.SaveToken = true;
options.RequireHttpsMetadata = false;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
ValidateAudience = true,
ValidAudience = builder.Configuration["JWT:ValidAudience"],
ValidIssuer = builder.Configuration["JWT:ValidIssuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JWT:Secret"]))
};
});
//Adding Authentication
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})

// Adding Jwt Bearer
.AddJwtBearer(options =>
{
options.SaveToken = true;
options.RequireHttpsMetadata = false;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
ValidateAudience = true,
ValidAudience = builder.Configuration["JWT:ValidAudience"],
ValidIssuer = builder.Configuration["JWT:ValidIssuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JWT:Secret"]))
};
});
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
using Data;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Net.Http.Headers;
using Microsoft.OpenApi.Models;
using Serilog;
using System.Configuration;
using System.Text;
using WebApiNeu.MailUtility;
using WebApiNeu.MailUtility.Contracts;
using WebApiNeu.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.AddDbContext<TestdusContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

// For Identity
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<TestdusContext>()
.AddDefaultTokenProviders();
builder.Services.Configure<SmtpConfiguration>(builder.Configuration.GetSection("SMTP"));
builder.Services.Configure<MailJetConfiguration>(builder.Configuration.GetSection("MailJet"));
using Data;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Net.Http.Headers;
using Microsoft.OpenApi.Models;
using Serilog;
using System.Configuration;
using System.Text;
using WebApiNeu.MailUtility;
using WebApiNeu.MailUtility.Contracts;
using WebApiNeu.Models;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.AddDbContext<TestdusContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

// For Identity
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<TestdusContext>()
.AddDefaultTokenProviders();
builder.Services.Configure<SmtpConfiguration>(builder.Configuration.GetSection("SMTP"));
builder.Services.Configure<MailJetConfiguration>(builder.Configuration.GetSection("MailJet"));
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
aye aye
27 replies
CC#
Created by Suraj Kumar on 6/18/2024 in #help
✅ Enable CORS
I did the error still comes... the list is updated now but the error still shows. please help me its very urgent. I am totally stuck
27 replies
CC#
Created by Suraj Kumar on 6/13/2024 in #help
✅ Blazor App
No description
5 replies
CC#
Created by Suraj Kumar on 5/30/2024 in #help
✅ Hangfire as windows service
Thanks for the help guys
21 replies
CC#
Created by Suraj Kumar on 5/30/2024 in #help
✅ Hangfire as windows service
Okay so then I have to create a seprate web app which feeds the table with date and time and then hangfire will scans the table.
21 replies
CC#
Created by Suraj Kumar on 5/30/2024 in #help
✅ Hangfire as windows service
How would I add web interface in the existing service
21 replies