200,751 questions
1
vote
0
answers
23
views
GoogleAuthenticator (2FA) fails validation on mobile browsers but works on desktop in C# & ASP.NET MVC
I am implementing Two-Factor Authentication in a C# & ASP.NET MVC project using the GoogleAuthenticator NuGet package (v3.2.0).
The issue: the authentication works perfectly on all desktop ...
1
vote
1
answer
103
views
Missing Publish Targets After Migrating ASP.NET MVC .vbproj file to SDK-Style using CZEMacLeod / MSBuild.SDK.SystemWeb
I'm using Visual Studio 2022 17.14.21. I have a VB.Net .NET Framework 4.8 based ASP.NET project that I upgraded to SDK-Style using the "Upgrade Assistant".
After the migration, I manually ...
0
votes
1
answer
69
views
Value cannot be null. Parameter name: provider using DI in .NET framework
I have added Microsoft DependencyInjection nuget to a .NET 4.8 project and used this post to help set it up: https://stackoverflow.com/a/73414927/2739613
My code looks like this - Startup.cs:
[...
0
votes
0
answers
26
views
Is it possible to achieve Content Security Policy compliance (remove 'unsafe-inline') without migrating inline script block to an external .js file?
In my ASP.NET MVC 5 project, I am migrating to a strict Content Security Policy (CSP) to eliminate the use of 'unsafe-inline' for scripts. While I have successfully implemented the nonce approach to ...
Best practices
0
votes
2
replies
82
views
Which ASP.NET MVC structure is better practice for medium-size applications?
From my research, best practice for project structure in ASP.NET seems to vary massively, particularly depending on the size of the application. I found this page from Microsoft: https://learn....
-3
votes
0
answers
42
views
MediatR Nuget package versions creating problems
I am getting a version mismatch error when using MediatR in my .NET project.
What happened:
Yesterday my project worked correctly with no errors.
Today I updated some NuGet packages by mistake.
After ...
Best practices
0
votes
3
replies
66
views
Add a NotMapped field to my model or create a view model to interface between the model and view?
I come from a MVVM in WPF background moving towards ASP.NET MVC. I have a model that is composed of another model called Message, like so:
public class User
{
public int Id { get; set; }
[...
Advice
0
votes
2
replies
51
views
Deploying ASP.NET API and ASP.NET MVC app on the same IIS default site
I have this scenario: I have an ASP.NET API which is deployed on IIS under the default web site. I have added the API by right click on default web site -> add application. API is working fine and ...
0
votes
0
answers
46
views
Issue with Add Draw Ink And Re Open in PDF Viewer after Modifications in library Syncfusion , Js And Asp.net core mvc
I am experiencing an issue when using Syncfusion PDF Viewer with PDF files after making edits using the Draw Ink tool or any other tools :
I opened a PDF file using PDF Viewer.
I added text using ...
2
votes
1
answer
70
views
Configure SignalR to work in all views. Which view is currently being viewed, in ASP.NET MVC?
I've implemented SignalR as an add-on to a user-to-user messaging system. I use it to notify the recipient that they've received a message.
This works when the recipient is already viewing their ...
0
votes
0
answers
38
views
SustainSys ASP.NET MVC 4.* question - The signature verified correctly with the key contained in the signature, but that key is not trusted
SustainSys has been working for webforms, ASP.NET MVC on .NET 4.8, and ASP.NET Core on one server for a while.
I want to move the apps to some other servers using the same certificate. I was able to ...
0
votes
1
answer
92
views
Database data missing when reading - ASP NET MVC
I'm working on a messaging platform type sales platform. A buyer can contact a seller about a product. Their message concerns a specific product.
The exchange of messages is only possible between a ...
2
votes
2
answers
217
views
How do you add a choicefield dropdown to the form builder connectors settings section in sitefinity using FormsConnectorDefinitionsExtender
I'm trying to add a dropdown to the connectorsSettings section in the form builder using FormsConnectorDefinitionsExtender.
My field gets added but only the first choice is rendered and is rendered as ...
0
votes
0
answers
50
views
Partial view with pagedlist inside a Tab control
After several days and multiple attempts using examples, I am still struggling to get a partial view to page inside a tab control. In the code below, when selecting the 'tab4' Tab 1st time, it ...
1
vote
2
answers
124
views
Foreign keys are null when retrieved, even though stored correctly in database
I have the following classes in my (code-first) Entity Framework Core database schema:
public class User
{
public int Id { get; set; }
// ... Irrelevant bits omitted
}
public class Church
{
...
0
votes
0
answers
53
views
TLS issues with ActionMailer.Net [duplicate]
I have an ASP.NET MVC application, that uses the following package
ActionMailer.net
This has been going beautifully for many years, but lately we have been hitting issues with the mail servers we have ...
0
votes
1
answer
94
views
Using [FromQuery] with a .NET controller for an optional boolean query string parameter where presence alone should set it
.NET has [FromQuery] to get query parameters on the path.
For instance my/foo?bar=1 maps to:
public class MyController : Controller
{
[HttpGet]
public async Task<Whatever> Foo([FromQuery]...
1
vote
1
answer
109
views
Keycloak supported ASP.net app loops following authentication
My program has recently began support of Keycloak and I have been doing my best to learn it while managing my other tasks. However, I recently came across an issue that I simply can not seem to solve.
...
1
vote
0
answers
67
views
Dockerizing ASP.NET MVC application on .NET 4.5.2 - 404 from ManagedPipelineHandler on hitting an action method
I am trying to dockerize an existing ASP.NET MVC application running on .NET 4.5.2. I am using mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 as the base image (the base ...
0
votes
0
answers
77
views
.AspNet.Cookies not set in IIS virtual application when using OWIN cookie middleware with .NET Framework
I'm running a .NET framework 4.7.2 application using OWIN cookie authentication under IIS as a virtual application locally (e.g., https://example.test/cms/) but I end up in and endless redirect loop ...
0
votes
1
answer
120
views
Owin security could not handle callback "signin-oidc", Error 404 on ASP.NET MVC
I have a simple ASP.NET MVC app with .NET 4.8.
I want to use keycloak as security management and my app connect to it via openid connect protocol.
To do this, I've created a startup.cs class in my ...
1
vote
1
answer
57
views
CSP Violation when including iframe in web page
I have an iframe embedded in an ASP.NET web form. I have included what I thought was the correct Content-Security-Policy values in the web.config.
However, I still get a CSP violation in the web ...
0
votes
0
answers
51
views
ASP.NET MVC on .NET 4.7.2 - HTTPS IFrame - The required anti-forgery cookie "__RequestVerificationToken" is not present
Starting yesterday, an ASP.NET MVC web application running on .NET 4.7.2 that is called in an IFrame stopped working with the following error:
The required anti-forgery cookie "...
0
votes
0
answers
48
views
How to configure ASP.NET MVC (.NET 4.8) app to work under /report location with Nginx?
I have an ASP.NET MVC application (on .NET 4.8). Currently, the DevOps team has set up Nginx to handle requests with: location: / and this works fine.
Now they want to change the setup so the ...
1
vote
1
answer
136
views
ASP.NET MVC: Anti-forgery token could not be decrypted after 10–15 minutes of idle time
I’m running an ASP.NET MVC application on IIS. The site structure is simple: a single IIS server (not a web farm or cluster) with one site that hosts several applications.
From time to time, I get the ...
0
votes
0
answers
65
views
Debug SessionState using SQL Server connection error
I have an ASP.NET MVC application that is configured to use SQL Server to save the session state. If there is an issue with the session state connection string (invalid password, server, etc) my ...
0
votes
0
answers
61
views
How to fix the 'Generic Padding Oracle' vulnerability when recommended steps fail
I have been scanning our deployed (ASP.NET Framework 4.7.2) applications for vulnerabilities and on one of them have encountered the OWASP warning Generic Padding Oracle. My understanding of this ...
2
votes
1
answer
110
views
Why doesn’t ActionResult<T> work in .NET Azure Functions isolated worker model?
I recently upgraded a .NET Function App from the in-process worker model to the isolated worker model.
After the upgrade, I noticed that none of the HTTP-triggered APIs were returning any data.
On ...
0
votes
1
answer
39
views
Fluent Validation error not firing due to list for comparison being empty
This a continuation of this question: ASP.NET MVC Create View - Where to place ValidationMessage (Fluent Validation) for a variable
ASP.NET MVC
Firstly, all the validation rules are firing except the ...
0
votes
1
answer
70
views
ASP.NET MVC Create View - Where to place ValidationMessage (Fluent Validation) for a variable
I have this validator class:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using DocumentFormat.OpenXml.Linq;
using ...
1
vote
1
answer
69
views
Button to save edit in its current model and then return you to previous Details view of a different model
I am using ASP.NET MVC. I have a PIF controller and on the details view, I have data showing from a variety of other models, one of which is called SAEs (I will use this as the example). For each of ...
0
votes
1
answer
49
views
Dropdown list choice not linking to underlying table in Details.cshtml when dropdown list is used for more than one field
I am using ASP.NET MVC with a SQL database backend. I have a table that lists individuals which I use for two fields in another table. One field is for the Chief Investigator (ChiefInvestigatorID), ...
1
vote
1
answer
56
views
href being interrupted by database login
I'm using ASP.NET MVC. This code sits in the Index.cshtml view (I will also place it in the details view). I have a href link which does what it's supposed to do if the user is logged into the ...
0
votes
0
answers
81
views
ASP.NET MVC model binding FormData with arrays (with bracketed indexes)
Using model binding, ASP.NET MVC can take FormData from a form with repeating elements, signified by the use of indexes in square brackets, and populate a .NET object.
So this:
MyItem[0].MyId=1321&...
1
vote
1
answer
158
views
"Resource not found for the segment" error reading email from Graph API
I have an Outlook web add-in which reads the currently selected email from Exchange Server, using the Graph API, before doing further processing on it. The relevant code is:
private static async Task&...
0
votes
1
answer
48
views
Kendo MVC Grid Row Filter without decimals
I have a kendo grid on an MVC site with several integer columns, and I am using a row filter. The problem is that when you enter a number in the filter, it shows up with commas and two decimal places.
...
0
votes
0
answers
79
views
ItextSharp C# : combine multiple PDFs with AcroFields specified
I have multiples PDF created with the iTextsharp library in C#. Those PDFs are created and are also using AcroFields.Item to create fields and field them with the users info.
Once I have created all ...
0
votes
1
answer
123
views
Does the dynamic keyword box the value types? [closed]
This project is ASP.NET MVC Framework 4.8 with Entity Framework 6 and uses:
dynamic GetSystemSetting(string paramCode, string paramType)
It contains Int, Float, Bool, String, and Guid values. It is ...
0
votes
0
answers
65
views
Error executing child request for handler: not finding the controller
I'm learning ASP.NET MVC with creating a minimal website which just shows some products.
I want to access my start project which it has layout and for that, I should run the project from /Home/Index.
...
0
votes
0
answers
49
views
How can I bind the results from a paginated ASP.NET Web API endpoint to a jQuery DataTables table in my ASP.NET MVC view?
I'm attempting to pass paginated results from a Web API to an MVC application and displaying in the View using DataTable. While I've successfully retrieved the data from the server and transmitted it ...
0
votes
0
answers
45
views
ASP.NET MVC Navigator.geolocation.getcurrentlocation sometimes remembers last location and is not refreshed
I have a webpage which allow a user to walk around and click a button to find their position on a map. This can be very accurate but often, if they have clicked the button before, it returns the same ...
1
vote
0
answers
51
views
DevExpress MVC Grid Callbacks Not Reaching Controller After Migrating to Azure AD B2C (OWIN)
I have an ASP.NET MVC web application using DevExpress controls (specifically ASPxGridView and MVCxGridView) that was originally using Forms authentication.
As part of a security enhancement, I’ve ...
-2
votes
2
answers
192
views
How to write a relative path for fetch() that works when my site is deployed in subdirectories? [closed]
Context
I'm building a web application using ASP.NET MVC, and I need to use the fetch() API to send data from the front-end to a controller action. The tricky part is ensuring that the fetch() path ...
0
votes
1
answer
53
views
How to turn off JSON error responses in ASP.NET Framework 4.5
We have an old app and no matter what we do, we can't seem to get it to stop emitting JSON error responses. We want just a generic message that won't expose important security details.
We've compiled ...
0
votes
0
answers
31
views
How to set the correct host name for returning URLs in a REST API using ASP.NET MVC when a binding has been applied?
I want to write a REST API that will expose a set of URLs to different services, I will return these inside a xml/json response. The REST API will need to be deployed/setup on different servers.
What ...
0
votes
1
answer
74
views
Cannot pass validation because lists that populate dropdowns are invalid for some reason
ListingController.cs:
public IActionResult Create()
{
CreateListingViewModel model = new()
{
AllCities = new SelectList(_addressRepo.AllCities()),
AllItems = new SelectList(...
0
votes
0
answers
38
views
IIS Proxy using ARR to communicate with http endpoint using .Net and Rasa
I try to communicate with a Rasa Chatbot hosted by a client from an ASP.NET Core 6 web app hosted by my company with IIS.
The chatbot runs currently on a computer with the address localhost:5005.
The ...
1
vote
0
answers
30
views
exe file not executing from deployed ASP.NET MVC app in TAS (Tanzu /PCF)
I am facing an issue for my ASP.NET MVC web application on .NET 4 being deployed to TAS.
I am trying to do image compression using ffmpeg.exe.
While it is working on my local machine, I get an "...
0
votes
1
answer
51
views
How to convert HttpResponseMessage to ViewResult?
I have an ASP.NET MVC controller endpoint of type ActionResult that returns a ViewResult by calling Controller.View(<some html>).
When integration testing this endpoint is it possible to convert ...
0
votes
1
answer
189
views
DevExtreme selectbox refresh (reload) datasource
I'm using a DevExtreme SelectBox in an ASP.NET MVC project. I want the data source to reload every time the dropdown is opened, so that dynamic LoadParams values (like EmployeeId and DocumentDate) are ...