Forum Widgets
Latest Discussions
Http requests from client to server project with cookie auth
Start a new Blazor app with individual accounts. Add a controller to the server project. [ApiController] [Route("api/[controller]")] [Authorize] public class TestController : ControllerBase { private readonly ILogger _logger; public TestController(ILogger logger) { _logger = logger; } [HttpGet("public")] [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] [AllowAnonymous] public IActionResult GetPublic() { return Ok(JsonConvert.SerializeObject("Now is the time for all good men to come to the aid of the public party.")); } [HttpGet("private")] [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] public IActionResult GetPrivate() { return Ok(JsonConvert.SerializeObject($"Now is the time for all good men and {User.Identity.Name} to come to the aid of the private party.")); } And route it in in Program.cs ... builder.Services.AddControllers(); // + ... app.MapControllers(); // + Create a HttpClient for the API public class CookieHandler : DelegatingHandler { public CookieHandler() { InnerHandler = new HttpClientHandler() { AllowAutoRedirect = false }; } protected override Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { request.SetBrowserRequestCredentials(BrowserRequestCredentials.Include); request.Headers.Add("X-Requested-With", ["XMLHttpRequest"]); return base.SendAsync(request, cancellationToken); } } public class LocalHttpClient : HttpClient { public LocalHttpClient(CookieHandler h) : base(h) { } } in the <em>client</em> project and register it in <em>both</em> the client and the server project. builder.Services.AddTransient(); builder.Services.AddTransient(); Update the client side page Auth.razor to use it @page "/auth" @using Microsoft.AspNetCore.Authorization @attribute [Authorize] @* @rendermode InteractiveWebAssembly *@ @rendermode InteractiveAuto @inject LocalHttpClient _HttpClient @code{ protected override async Task OnInitializedAsync() { HttpResponseMessage rx = await _HttpClient.GetAsync("https://localhost:7131/api/Test/public"); Public = await rx.Content.ReadAsStringAsync(); rx = await _HttpClient.GetAsync("https://localhost:7131/api/Test/private"); Private = await rx.Content.ReadAsStringAsync(); if(!rx.IsSuccessStatusCode) { Private = (Private ?? "") + rx.StatusCode.ToString(); } await base.OnInitializedAsync(); } string Public { get; set; } string Private { get; set; } } <PageTitle>Auth</PageTitle> <h1>You are authenticated</h1> <p>Public: <code>@Public</code></p> <p>Private: <code>@Private</code></p> <AuthorizeView Context="AuthorizeViewContext"> Hello @AuthorizeViewContext.User.Identity?.Name! </AuthorizeView> The authorisation doesn't work.RichardB1640May 07, 2026Copper Contributor30Views0likes0CommentsGetting a ConnectionString empty error in a webapi project with .net 10
I'm running in .NET 10 with the most recent update for everything. I'm in EF. I'm ASP.NET Core. Below is my program.cs file. Inside of the program.cs file, when I call to get my connection string, I get back what I expect. When I hit the LoginController, I see the settings in the IConfiuguration that is handed in. However, when I set a breakpoint in the FSMUserStore constructor, I check the context that is handed in, and it's connection string is not set correctly (at all). I've run through Visual Studio debugger so many times, and tried so many things, I'm just lost on this. I think the problem is in how I am setting up for dependency injection in the program.cs file, but I've tried so many things that I don't know what else to try. Anyone have a suggestion? using ElmahCore.Mvc; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using Portal.Libraries; using PortalDataModels.Models; using System.Text; using Twilio.TwiML.Voice; var builder = WebApplication.CreateBuilder(args); IConfiguration configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables() .Build(); // connString get's the correct value var connString = configuration.GetConnectionString("DefaultConnection"); // Add services to the container. // For Entity Framework builder.Services.AddDbContext<PortalDataModels.Models.POA_CSMContext>(options => options.UseSqlServer(configuration.GetConnectionString(connString))); builder.Services.AddScoped<IUserStore<FSMUser>, FSMUserStore>(); builder.Services.AddIdentity<FSMUser, IdentityRole>() .AddEntityFrameworkStores<POA_CSMContext>() .AddUserManager<UserManager<FSMUser>>() .AddSignInManager<SignInManager<FSMUser>>() .AddDefaultTokenProviders(); builder.Services.AddElmah<ElmahCore.Sql.SqlErrorLog>(options => { options.ConnectionString = connString; options.SqlServerDatabaseTableName = "Elmah_Error"; //Defaults to ELMAH_Error if not set options.OnPermissionCheck = context => false; }); // 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.MapInboundClaims = false; options.TokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = true, ValidateAudience = true, ValidAudience = configuration["Jwt:ValidAudience"], ValidIssuer = configuration["Jwt:ValidIssuer"], IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["Jwt:Key"])) }; }); builder.Services.AddScoped<UserManager<FSMUser>>(); builder.Services.AddControllers(); // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi builder.Services.AddOpenApi(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.MapOpenApi(); } app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); app.Run();wallymMay 05, 2026Copper Contributor64Views0likes1CommentPaytmgateway integration throwing exception error
While integration paytmgateway to my asp.net project, throwing exception "exception occurred while verifying checksum. Invalid padding can't be removed. What to do? I put every data right like merchant key ,MID etc . Plz guide menaveen271336Mar 15, 2026Copper Contributor53Views0likes0CommentsBlazor parameter passed by reference
I got the impression that in Blazor parameters are always effectively passed by value which is why you need to use EventCallback for two-way binding to send a change in the parameter value back up to the component that passed it. But not so; reference types really are passed by reference. Therefore if a child component updates a parameter value that is a reference type then the value in the parent is changed and all you need to do is call `StateHasChanged` on the parent. Is this as intended? Have I misunderstood the documentation? Example: https://drive.google.com/file/d/1i1Rh36nHU1Z2voyHDtLVZ9GyziLw9AQq/view?usp=sharing (Don't seem to be able to attach here and it's not really feasible to inline a whole Blazor project.)RichardB1640Feb 26, 2026Copper Contributor199Views0likes2CommentsSharePoint List View Threshold Error while Fetching 5000+ Records in list.
I am fetching data from a SharePoint list that contains more than 5000 records inside my function. While retrieving the data, I am getting the following error: “Flow Reminders→ The attempted operation is prohibited because it exceeds the list view threshold.” Scenario: The SharePoint list has 5000+ items. Data is being fetched programmatically. The error occurs during query execution. What I need help with What is the recommended and best-practice approach to retrieve large datasets from a SharePoint list without hitting the list view threshold? Questions: What is the recommended approach to fetch large data from a SharePoint list without hitting the list view threshold? Any suggestions, examples, or documentation references would be greatly appreciated. Thanks.AjayMFeb 23, 2026Copper Contributor55Views0likes0CommentsIt appears and error that does not exist
I am using VS 2022 Community and when i develope asp.net apps it happens sometimes that it appears an error that does not exist adn only after many hours of searching for the error or rewriting the same code the app begins to run correctly. Somehitng simmilar happened to any of you ? how can i avoid these strange behaviour of the compiler ? Thank you in advance Luis MartinlmobarqDec 12, 2025Copper Contributor93Views0likes0CommentsConnect .Net (4.6.2) to Dataverse using the Dataverse plugin
Hi Microsoft Tech Community, We have a Dataverse environment in our tenant, and I have its URL. I'm building a .NET application and need to connect it to Dataverse for data access. From the Learn docs, ChatGPT, and Copilot, it seems I need to use an App ID (Client ID) and Client Secret in the connection string (e.g., via Microsoft.PowerPlatform.Dataverse.Client). However, the Dataverse environment itself doesn't expose any App ID or Client Secret—where would I even find those if they exist? Here's the code snippet we found online that's using OAuth with AppId and RedirectUri, but we're unsure about the app registration part: using Microsoft.Crm.Sdk.Messages; using Microsoft.PowerPlatform.Dataverse.Client; using Microsoft.Xrm.Sdk; class Program { // TODO Enter your Dataverse environment's URL and logon info. static string url = "https://yourorg.crm.dynamics.com"; static string userName = "email address removed for privacy reasons"; static string password = "yourPassword"; // This service connection string uses the info provided above. // The AppId and RedirectUri are provided for sample code testing. static string connectionString = $@" AuthType = OAuth; Url = {url}; UserName = {userName}; Password = {password}; AppId = 51f81489-12ee-4a9e-aaae-a2591f45987d; RedirectUri = app://58145B91-0C36-4500-8554-080854F2AC97; LoginPrompt=Auto; RequireNewInstance = True"; static void Main() { //ServiceClient implements IOrganizationService interface IOrganizationService service = new ServiceClient(connectionString); var response = (WhoAmIResponse)service.Execute(new WhoAmIRequest()); Console.WriteLine($"User ID is {response.UserId}."); // Pause the console so it does not close. Console.WriteLine("Press the <Enter> key to exit."); Console.ReadLine(); } } Do I need to create a separate app registration in Microsoft Entra ID (Azure AD), link it to the Dataverse environment (perhaps as an application user?), and then use that app's Client ID/Secret in my .NET code? If so, could someone outline the exact steps, including permissions and Power Platform admin center setup? Any guidance or links to official walkthroughs would be greatly appreciated—thanks!AjayMDec 08, 2025Copper Contributor144Views0likes0CommentsDebug Asp.Net - "This site can't be reached"
Hello, Today, all my Visual Studio 2019 Community projects stopped debugging and are displaying the following message in the browser: "This site can't be reached." I've tried using Visual Studio 2022 Community, but the problem is the same. I have numerous projects (Asp.Net - vb), and they all have the same issue. Even creating a new project (VS 20219 or VS 2022), the error persists. I've tried reinstalling IIS Express, disabling my antivirus, and reinstalling Visual Studio 2022 (since it was just for testing). Nothing works. Everything was working until yesterday, but now I can't work anymore. It seems like a Windows update, but I don't have restore points to revert to. I'd appreciate it if anyone has any idea what this could be. EduardoSolvedEduardoFornaroOct 15, 2025Copper Contributor411Views0likes2CommentsDebugging Java script in old asp core app
Hy, I need to modify an asp.net.core app witch I made years ago. in version 2.2. I do succeed to alter C# code in visual studio (2022), but I need to alter also some Java script. The problem is that if I try to do so and I want to debug it it seems that the script in my browser (MS Edge) is not changing. I have enabled Java script debugging in VS. I emptied the browsers cache but nothing seems to help. When I run the application in debugging mode and hit F12 I still see the old script. Please help!RobertWarningSep 07, 2025Copper Contributor68Views0likes0CommentsIs Native RDLC Report Support Planned for Future .NET Versions?
Good day Team, Given the demand for cross-platform reporting solutions, is there any plan to provide native RDLC (Report Definition Language Client-side) support for .NET Core or upcoming .NET releases (e.g., .NET 9 and beyond)? Many enterprise applications rely on RDLC, and the current lack of official support limits modernization efforts and forces continued reliance on the legacy .NET Framework or Windows-only workarounds. Is RDLC on the roadmap for future .NET versions, or should we consider alternative technologies for long-term reporting requirements? Any official guidance or updates would be greatly appreciated.VelkumarAug 18, 2025Copper Contributor112Views0likes0Comments
Tags
- ASP.NET Core161 Topics
- ASP.NET (Classic)87 Topics
- Web API69 Topics
- Blazor64 Topics
- mvc56 Topics
- Razor Pages35 Topics
- IIS.NET29 Topics
- security26 Topics
- SignalR6 Topics
- community1 Topic