200,782 questions
Best practices
0
votes
2
replies
32
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
41
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
39
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 ...
0
votes
1
answer
86
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 ...
0
votes
0
answers
30
views
Build on save no longer working in vs 2022 - 17.14.20
This only happened a few days ago and I usually keep on top of the updates in vs 2022. When making a change the the code behind for a razor partial view - hitting save would auto-build the changes and ...
1606
votes
48
answers
1.2m
views
A potentially dangerous Request.Form value was detected from the client
Every time a user posts something containing < or > in a page in my web application, I get this exception thrown.
I don't want to go into the discussion about the smartness of throwing an ...
0
votes
0
answers
40
views
.NET - How can I update downloading a .tiff file from .NET 4.5 to 8? [duplicate]
I'm currently working on migrating a project from .NET 4.5 to 8. One of the key functionalities of the old project is the ability to download a barcode of a given string:
Old functionality
public ...
0
votes
0
answers
40
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 ...
361
votes
73
answers
459k
views
ASP.NET 5 MVC: unable to connect to web server 'IIS Express'
What I'm doing:
Opening Visual Studio Community 2015
File -> New -> Project
Under Visual C#: Web -> ASP.NET Web Application
Web Application
And press f5 for the popup error "unable to connect to web ...
340
votes
27
answers
331k
views
You must add a reference to assembly 'netstandard, Version=2.0.0.0
The project is an ASP.NET MVC Web App targeting the .NET Framework 4.6.1.
All of a sudden (some NuGet packages were upgraded) I started to get the following error during runtime:
CS0012: The type '...
547
votes
42
answers
198k
views
ReSharper "Cannot resolve symbol" even when project builds
My Tools:
Visual Studio 2012 Ultimate + Update 1
ReSharper v7.1.25.234
My Solution Build Status: Build Successfully
But when I install ReSharper and ReSharper code analysis is enable, many ...
1
vote
0
answers
56
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 ...
786
votes
36
answers
522k
views
How do you handle multiple submit buttons in ASP.NET MVC Framework?
Is there some easy way to handle multiple submit buttons from the same form? For example:
<% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %>
<input type="submit" value="Send" ...
604
votes
38
answers
2.3m
views
JQuery - $ is not defined
I have a simple jquery click event
<script type="text/javascript">
$(function() {
$('#post').click(function() {
alert("test");
});
});
&...
1
vote
1
answer
43
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
62
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 ...
876
votes
23
answers
393k
views
File Upload ASP.NET MVC 3.0
(Preface: this question is about ASP.NET MVC 3.0 which was released in 2011, it is not about ASP.NET Core 3.0 which was released in 2019)
I want to upload file in asp.net mvc. How can I upload the ...
0
votes
1
answer
68
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 ...
194
votes
60
answers
157k
views
Test method is inconclusive: Test wasn't run. Error?
I have a test class and below I have posted a sample test from the test class
namespace AdminPortal.Tests.Controller_Test.Customer
{
[TestClass]
public class BusinessUnitControllerTests
{
...
547
votes
22
answers
439k
views
How to get all Errors from ASP.Net MVC modelState?
I want to get all the error messages out of the modelState without knowing the key values. Looping through to grab all the error messages that the ModelState contains.
How can I do this?
1
vote
1
answer
67
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 ...
1089
votes
13
answers
646k
views
Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction
In ASP.NET MVC, what is the difference between:
Html.Partial and Html.RenderPartial
Html.Action and Html.RenderAction
0
votes
1
answer
36
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
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), ...
253
votes
28
answers
239k
views
Razor View throwing "The name 'model' does not exist in the current context"
After significant refactoring in my MVC 4 application, and Razor shows this error while debugging Views:
The name 'model' does not exist in the current context.
This is the offending line of code:
@...