All Questions

Tagged with
Filter by
Sorted by
Tagged with
114 votes
7 answers
101k views

How to fix "The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time" error

I've already enabled CORS on the project in C# .net Core In startup.cs I've added lines ... services.AddCors(); ... app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() ...
Igor Cova's user avatar
  • 3,274
69 votes
11 answers
73k views

Failed to find a valid digest in the 'integrity' attribute for resource in Blazor app

I have a Blazor client/server app that I have been working on for a period and it has been working fine up to now. I suddenly started getting this error Failed to find a valid digest in the '...
Bjørn Hellesylt's user avatar
49 votes
8 answers
101k views

.NET Core Blazor: How to get the Checkbox value if it is checked?

I am trying to find to get the checkbox value if it is checked using Blazor framework, but I couldn't find any method for it so far. When I put the binding in the checkbox, it is always checked. I ...
jorjj's user avatar
  • 1,519
46 votes
9 answers
69k views

How to use Bootstrap modal in Blazor client app?

I am trying to show bootstrap modal then bind its buttons. But I cannot pass the first step showing the modal. I am using Blazor client template of .net core 3.1. I have a page named Modal.razor ...
Sorush's user avatar
  • 3,621
32 votes
4 answers
66k views

Blazor template with menu across the top

I've created a new blazor app from the VS2019 template which has the menu as a sidebar. I've spent best part of the morning trying to get the menu across the top of the page like the current MVC ...
Calanus's user avatar
  • 26k
30 votes
7 answers
22k views

Auto reconnect Blazor Serverside

Blazor serverside (dotnet core 3.1) I run into the problem that on customer side this is shown: Could not reconnect to the server. Reload the page to restore functionality. Each time I update the ...
baer999's user avatar
  • 912
27 votes
5 answers
22k views

How to stop event propagation in Blazor Server app

I'm using Grid.Blazor library to render server side grid on Blazor app. One of the column has a button with click event. So when button is clicked then grid row event is also fired along with button ...
Venkata Dorisala's user avatar
27 votes
3 answers
13k views

What is the difference between @{} @code{} and @function{} in Blazor?

I am learning server-side. Blazor . I have read the code of some projects and found some that use: @{ } and some that use: @code{ } and others that use: @function{ } to mark the code block. I ...
Melon NG's user avatar
  • 2,814
26 votes
4 answers
30k views

Blazor Project structure / best practices

My company is moving from a legacy codebase to a more modern platform and we are moving to Blazor. We are currently just getting involved with ORM's and best practices and there seems to be a lot of ...
Dan's user avatar
  • 766
24 votes
10 answers
58k views

How to create NavMenu with collapsible submenu in .Net Core Blazor app

I am trying to create a blazor navmenu which has a shape like this item a item b when I click on item b it expands with sub menu like this and clicking on subitems, new pages open item a item b ...
Sorush's user avatar
  • 3,621
23 votes
3 answers
17k views

How can I change the "Could not reconnect to the server" text in Blazor?

I am using the Blazor server-side. When the Blazor App disconnect to the remote server, it will shows this: I want to change the text ('Could not reconnect to the server...' and so on) of the image ...
Melon NG's user avatar
  • 2,814
23 votes
3 answers
28k views

Passing method to component

I have been trying to work out how if its possible and how to pass a method from the main page into a component in Blazor. I have a simple razor page, which contains a component with a button. I ...
Linda Lawton - DaImTo's user avatar
23 votes
5 answers
14k views

How to bind to document events with Blazor

I am writing a simple snake game with Blazor, but I can't figure out how to bind to document events. I know that it is possible to bind events on different elements such as div or input. Example: <...
XelMed's user avatar
  • 331
22 votes
1 answer
30k views

How to add controller (not view) support to a server-side Blazor project

While my server-side Blazor app is running, I want some Javascript code in _Host.cshtml to be able to post data to a controller action. Of course, this happens completely outside of the scope of, and ...
Pancake's user avatar
  • 807
22 votes
2 answers
9k views

Missing visual studio 2019 blazor webassembly app template

I updated my vs 2019 16.3.10 to 16.4 and .net core 3.0 to .net core 3.1 but the blazor web assembly application template is missing.
Omid Ataei's user avatar
21 votes
5 answers
18k views

Blazor TwoWay Binding on custom Component

I'm creating a blazor server side app and have problems to bind a value between two custom components. I've looked through different example of how the bind or @bind is supposed to work but I cannot ...
Drew Fyre's user avatar
  • 588
19 votes
2 answers
10k views

How to use subfolders in the Pages and Shared folders

I've got a Blazor Server-Side application. It has the folders Pages and Shared out-of-the-box. Since I have a lot of components in these folders, I wanted to distribute the components into multiple ...
Pascal R.'s user avatar
  • 2,163
17 votes
1 answer
8k views

Convert Blazor Server App to Blazor Web-assembly approach

I want to develop an SPA project by Blazor technology. Due to complexity of debugging the Blazor Web-assembly application, I would like to first create it as a server-side app, and then later change ...
Mohamad Jalalian's user avatar
16 votes
1 answer
5k views

@attribute [AllowAnonymous] in Blazor server-side component has no effect

I have created a fresh Blazor server-side project with .NET Core 3.0 and have closed down the application for non-authenticated users. I am now trying to allow anonymous access to Index.razor ...
Anonymous's user avatar
  • 1,343
15 votes
13 answers
23k views

Event for click outside a div or element to close it on Blazor

In my Blazor server-side project, I need to close a pop-up menu by clicking outside the menu. I use a simple If statement to show/hide the pop-up by triggering the onClick event. but there is no such ...
AminM's user avatar
  • 359
15 votes
5 answers
29k views

How can I change css directly(without variable) in Blazor?

I am using the server-side of Blazor. I want to change the CSS of the body. In Jquery I can write the code like this easily: $("body").css("overflow-y","hidden"); However, with this tutorial(...
Melon NG's user avatar
  • 2,814
15 votes
3 answers
10k views

CancellationToken in Blazor Pages?

After living under a rock for 2 years employment wise, I am now confronted with Blazor at my new Workplace and have a lot of catch up to do after doing mostly ASP.NET Framework MVC prior to the 2 ...
Kyte's user avatar
  • 438
15 votes
7 answers
15k views

Blazor: Managing Environment Specific Variables

How can I manage access variables which differ among environments in client side blazor? Normally since I use Azure to publish applications, I'd use the appsettings.json file for local app settings ...
GregH's user avatar
  • 5,267
15 votes
5 answers
31k views

Blazor Request blocked by CORS policy

I am trying to send a request from a Blazor(client-side) client to a server and i keep getting this error: Access to fetch at '[route]' (redirected from '[other route]') from origin '[origin ...
Bercovici Adrian's user avatar
14 votes
1 answer
5k views

Blazor exception - The current thread is not associated with the Dispatcher. Use InvokeAsync()

I my Blazor application I have such exception System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when ...
ClubberLang's user avatar
  • 1,706
13 votes
5 answers
17k views

Multiple query string parameters in Blazor routing

I have multiple working examples in my current project of retrieving 1 query parameter from the url however when trying to follow the same convention for multiple url params, I'm receiving the ...
GregH's user avatar
  • 5,267
13 votes
2 answers
6k views

Blazor onclick event passing in counter from loop

I'm currently implementing table paging via a home grown solution in Blazor and coming across some difficulty. The troublesome piece of code is below (this is for rendering the paging buttons below a ...
GregH's user avatar
  • 5,267
13 votes
5 answers
34k views

How do I upload files with Blazor?

I found the BlazorInputFile library, but there are still-open PRs from October of 2019, and I am not sure whether this library is still maintained. Also, I found a couple articles in blogs about how ...
Sergey  Pitenko's user avatar
12 votes
3 answers
18k views

How to configure HttpClient base address in Blazor Server using IHttpClientFactory

I am trying to configure HttpClient 's base address in a Blazor Server using IHttpClientFactory but I am getting a runtime exception: services.AddHttpClient("ApiClient", (provider, ...
Mihaimyh's user avatar
  • 1,330
11 votes
4 answers
7k views

Running multiple ASP.NET Core (3.1x/Latest) websites on port 80 with Kestrel

I'm using (ASP).NET Core (3.1x), C#, Blazor and Microsoft Kestrel Web-server and I'm wondering if I can run 2 or 3 different websites (domain names) on one Kestrel instance and on port 80. I would ...
Jaap's user avatar
  • 695
11 votes
2 answers
3k views

Why is client-side Blazor using .NET Standard 2.0 and how to use .NET Core 3.0 with Blazor?

Is it possible to use .NET Core 2.2 or 3.0 with Blazor? Because at this moment, the blazorhosted template creates a client-side project as .NET Standard which prevents using .NET Core 3.0. Project ...
Axelly's user avatar
  • 719
10 votes
2 answers
21k views

Access Device Camera with Blazor

I have a Blazor Web Assembly PWA, how do I open a devices native camera? I am trying to write a PWA to capture and save pictures. EDIT Would like to save captured images as jpeg's to Azure Blob ...
Anthony Ryan's user avatar
10 votes
1 answer
2k views

How to disable an entire Blazor EditForm, along with all fields?

I'm used to the handy form.disable() method in Angular's reactive forms, which disables all bound fields in the given form group (which can be the whole form). And obviously enabling them in a similar ...
Leaky's user avatar
  • 3,316
10 votes
1 answer
6k views

Using @ref inside for loop to get element reference

Im trying to get the position of same object in different places, where ,with a javascript function, I should get different top positions but thats not the scenario. The script code: <script type="...
LOL Jovem's user avatar
  • 197
10 votes
2 answers
16k views

How can I get the event while page close in blazor server-side?

I am making a chatroom App by the blazor server-side. I want to show the online state of each user. Now I can use the OnAfterRenderAsync event to get a user has entered the page. It seems there is ...
Melon NG's user avatar
  • 2,814
10 votes
4 answers
8k views

Blazor Navigationmanager cancel navigation on locationchanged

Question: Is there a way on Blazor to cancel navigation? Let's supose a siple a href like this: <a href="/some/other/blazor/spa/page">Go</a> I would like to cancel navigation (...
dani herrera's user avatar
  • 50.3k
10 votes
2 answers
16k views

Blazor inline editing table and getting all component values on event

On a Blazor component, I have this table in which I'm trying to implement inline editing functionality. I've managed the visual bits, but when it comes to grabbing the new values from the changed row ...
Selim Balci's user avatar
10 votes
4 answers
7k views

Error Upgrading Blazor from 3.1 to 5.0 "does not have a property matching the name 'PreferExactMatches'"

As per the migration document here it recommends to add this property PreferExactMatches When I do I get this error InvalidOperationException: Object of type 'Microsoft.AspNetCore.Components.Routing....
Arjun Shetty's user avatar
  • 1,585
9 votes
1 answer
4k views

Blazor route changes in same page

I'm current setup: .NET core 3 (preview 6) Blazor server side rendering In a Blazor page I have something like the following: @page "/page" @page "/page/{Id}" With: [Parameter] public string Id { ...
Gilian's user avatar
  • 1,559
9 votes
2 answers
4k views

How to get/inject services in custom ValidationAttributes

We're on .NET Core 3.1.5 and this is a Blazor Server application. We have a ValidationAttribute and need access to an external Service to validate the objects. ValidationAttribute has the IsValid ...
Soeren's user avatar
  • 257
9 votes
2 answers
7k views

How can I invoke method in CircuitHandler of Blazor server-side?

I am making a chatroom application by Blazor server-side. I want to show the online state of each user. I have asked a question for how to get the event while closing the page in How can I get the ...
Melon NG's user avatar
  • 2,814
9 votes
3 answers
7k views

Blazor Connection Disconnected

I have a web app with Client running on Blazor Server. I have set a custom Blazor reconnect modal (<div id="components-reconnect-modal"...) as the documentation says here - Microsoft Docs ...
Ivelin Matev's user avatar
8 votes
1 answer
3k views

How do I change the "Authorising..." message that appears when a Blazor PWA application is being refreshed?

When an asp net hosted BLAZOR Progressive Web Application is refreshed using browser refresh, PWA application performs an authentication roundtrip. During this time span, main content div displays ...
zir's user avatar
  • 129
8 votes
4 answers
25k views

Reading server-side files using Blazor

I have a project based on the Blazor sample with a .Client, .Server and .Shared projects. I have a textfile data.txt on the server that I want to be able to read/write using standard StreamReader / ...
jsmars's user avatar
  • 1,768
8 votes
5 answers
19k views

Blazor: Implementing 404 not found page

I'd like to implement a page internal to my application that appears when the blazor router is unable to find a matching route. Currently, all requests are routing to index.html so I'm unable to ...
GregH's user avatar
  • 5,267
8 votes
2 answers
7k views

EF Core list of Enums

I'm working on small application with organizing hotel reservations in Entity Framework Core. I need to add information about number and the type of beds in every room. I was thinking and I decided ...
Hesh's user avatar
  • 141
8 votes
1 answer
3k views

Blazor pages in multiple projects

I have 3 projects Projection.Server - this contains the host file and startups Projection.Shared - This contains the controllers and pages (class library) Components.Shared - This contains all ...
bobby's user avatar
  • 203
8 votes
2 answers
14k views

.Net Core 3 Blazor Server - How to do basic login with claims?

I already have tables with usernames, passwords, and role IDs, so I do not want to use the ASP.NET Membership tables. And I only need a simple login page that asks for username and password, not ...
FirstDivision's user avatar
8 votes
1 answer
12k views

Render Razor Partial View in Razor Component (Blazor)

I am newly discovering Blazor and have been playing with some test projects to better gauge how I might include this in future projects. Coming from an MVC background I have started with an MVC ...
Jarmez De La Rocha's user avatar
8 votes
1 answer
1k views

dotnet watch run -c $(Configuration) with hot reload

I want to launch my Blazor app with specific configuration and have hot-reload enabled. When I launch with: dotnet watch Hot reload is enabled and everything it's ok. When I lanch with: dotnet watch ...
Okan S.'s user avatar
  • 81

1
2 3 4 5
14