478 questions
0
votes
0
answers
28
views
ASP.NET MVC 5 child action Posts (instead of GET) after a view posts
I have a child action in my _Layout file like this:
@{ Html.RenderAction("ChangeLanguage", "Shared"); }
The code is:
[HttpGet]
[ChildActionOnly]
public PartialViewResult ...
0
votes
1
answer
20
views
AngularJs + ASP.NET MVC 5 - Handle BE redirection (HTTP code 302)
In my ASP.NET MVC 5 I use also AngularJS and my stateProvider contains also these nested states:
$stateProvider
.state("data",
{
url: "/data",
templateUrl: "Template/...
0
votes
1
answer
67
views
Is there a way to prevent page url parameters being passed to HTML.Action in ASP.NET MVC 5
The documentation for Action (HtmlHelper, String, String, Object) (or the RouteValueDictionary version) states that "The routeValues parameter is merged with the original route values and ...
0
votes
1
answer
625
views
How to get Playwright .NET tests to run in Azure DevOps Server against IIS using Windows Authentication
I'm trying to get our Playwright tests to run in our CI/CD pipeline. I'm finding scant documentation on how to do so with regards to our specific situation. Here are the key components:
Code is .NET ...
0
votes
0
answers
39
views
Partial view dropdown contents filtered by other dropdown selection
I have created a database-connected ASP.NET MVC 5 application and it works beautifully with the exception of being able to filter one dropdown based in the selection in another dropdown.
I have tried ...
0
votes
1
answer
86
views
I got stuck on ModelState.IsValid in ASP.NET MVC
I get stuck on the ModelState.IsValid. I try to solve them from the other example, but it not worked. Could you guy help on me please?
This is my controller:
[HttpPost]
[ValidateAntiForgeryToken]
...
0
votes
1
answer
502
views
Partial View error HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete
My application is running on MVC 5 . Recently I upgraded the Npgsql nuget package version and after that started getting below error in the application.
**Error :- **
HttpServerUtility.Execute blocked ...
0
votes
0
answers
26
views
Routing cannot map action parameters correctly
I have this in RouteConfig.cs file:
routes.MapRoute(
name: "PreSeleccion",
url: "{controller}/{action}/{month}/{id}",
defaults: new { ...
0
votes
1
answer
70
views
How to write a general rule to redirect all user urls to one valid Url by using asp.net mvc 5?
I want to redirect if user type some Urls in the browser. My application is developed in Asp.net MVC 5.
please see the possible user inputs in the browsers
User can enter
1). test-systems.co.uk
2). ...
0
votes
0
answers
151
views
Is it possible that an ASP.NET httpContextBase ever be null? or Request? or UserAgent?
I'm getting a bug in a production server. I know which line is, but I do not know which would be the one that is complaining of a "Object reference not set to an instance of an object." ...
0
votes
0
answers
140
views
MVC application under NGNIX rule to run application with virtual directory URL
I have MVC 5 application which is running on IIS on this URL http://localhost:8080. I want to get it run by appending some text in the url like http://localhost:8080/app. To achieve this I have done ...
0
votes
0
answers
74
views
unable to redirect to the line from where the action method is called in mvc
I have the following View code in which I am displaying a list of flights.
@using Airline_Reservation_System.Models;
@{
AirlineContext ac = new AirlineContext();
var ddlcabin = ac.Cabins....
0
votes
1
answer
962
views
ASP.NET MVC error cannot convert lambda expression to type 'string' because it is not a delegate type
View - MovieForm.cshtml:
<div class="form-group">
@Html.LabelFor(m => m.Movie.GenreId)
@Html.DropDownList(m => m.Movie.GenreId, new SelectList(Model.Genres, "Id"...
0
votes
1
answer
1k
views
Server.GetLastError() returns null when Internal Server Error (500) occurs
I am making a module that logs the errors to a .log file and save it to the database. I am only triggering the logging under this following instances:
Ajax errors. More specifically, error 500 status ...
10
votes
1
answer
3k
views
How to convert MVC5 project to SDK style
I have an MVC 5 web project (referencing Microsoft.AspNet.Mvc (5.2.8) and Microsoft.AspNet.WebApi.WebHost (5.2.8)) and I would like to convert the project file to SDK style.
I know this is not ...
9
votes
5
answers
2k
views
How to set 2 routes point to the same controller in ASP.NET MVC 5
I have an ASP.NET MVC 5 web site which has a controller MyFirstController.
That way, I can load the index view by using https://example.server.com/MyFirst.
On the other hand, I have another view that ...
0
votes
1
answer
1k
views
Authenticate Asp.net 4.7.2 application to Azure AD using x509 certificate
We have updated several .Net Core / 5 applications to authenticate with Azure AD at the application level (not user) by registering them in Azure AD with x509 certificates. With the purpose of ...
0
votes
0
answers
52
views
C# ASP.NET API constructor looping on WIndows Server 2008 R2
I host my Web API application on Windows Server 2008 R2 (IIS Version 7.5), development using .NET Framework 4.8. When I try to make a request, in the class below and perform remote debugging, the ...
1
vote
0
answers
20
views
How to custom validate specific data type system-wide in Aspnet MVC5?
I ran into issue validating dates in my application. There are approximately 40 models with maybe a few dozen date fields between them. I have custom validations assigned to many models via attributes,...
1
vote
0
answers
912
views
C# 8000401a The server process could not be started because the configured identity is incorrect
I'm trying to use the office component to convert a excel file to a pdf file ,but I get the exception as blow
<exception><![CDATA[System.Runtime.InteropServices.COMException (0x8000401A): ...
6
votes
0
answers
801
views
Upgrading from VS 2013 to 2019: Running/Debugging a VS 2013 MVC 5 with EF6 in VS 2019 causing lazy load errors
I'm trying to abandon using VS 2013 and run/debug our app in VS 2019. It's an MVC 5 app (.NET 4.7.2) that uses EF6 (code first). I can start it up and it loads a page. The problem is, it seems to ...
0
votes
0
answers
312
views
Data annotation to clean field before posting
I have an MVC C# application working and all is good, however, I have just found something bad.
I have a form that allows input text. Of course, that input text is rendered using an HTML helper.
The ...
1
vote
0
answers
1k
views
How to embed access token in URL and validate it - Asp.Net MVC
I want to construct a URL, per user for a set of users, which should be embedded with a access token so that the user can use the URL to login into the application and access a specific page without ...
1
vote
0
answers
2k
views
MVC5 using MFA (Microsoft Authenticator App)
I am looking after a legacy app using MVC 5. Is it possible to integrate MFA (Microsoft Authenticator App) to this web application?
All articles from Microsoft seem to use the new .net core
Thank you
0
votes
1
answer
145
views
Routing code working in ASP.NET MVC 5.0 no longer works in 5.2
I have code that runs on application start that prefixes all of my routes with a {lang} parameter.
The intent is to transform any URL like /page to {lang}/page, with {lang} being a language code (&...
0
votes
1
answer
452
views
Create DropDownList with OptGroup
I'm attempting to create a drop down list from one table in my database grouped by names from a different table in the same database.
What I have is a table that holds a bunch of units. These units ...
2
votes
1
answer
394
views
Callback not being raised for an overloaded mocked method
I'm building a multi-tenant website, and so I need to overload UserManager.CreateAsync() to accept an additional parameter of type City. In other words, each User belongs to a City. I've configured ...
1
vote
1
answer
976
views
Kendo: Full width with floating labels enabled
I started to use the new floating labels but I notice that the controls, otherwise with full width, are now resized to default. Here is my code:
<div class="form-group">
<div ...
0
votes
1
answer
680
views
Ajax.BeginForm triggers OnFailure with no reason
I got stucked with (it seems to be) a simple problem.
My goal is to create a modal with an Ajax form. A child action gets the modal in a partial view, and when edited, submit button posts Ajax form ...
0
votes
1
answer
162
views
ConfirmEmail Action method returns 404
I am working on asp.net mvc application, The issue i am facing is that when a user clicks on the confirm your account link in his email, the action method "Account/ConfirmEmail" which take ...
1
vote
0
answers
998
views
How can I get a PDF file from API in Asp.net MVC?
I wanna get a pdf file from API in ASP.Net core, but I don't know how to do this.
what I do is send a model to the api and I receive a pdf file
This is the method in my API that returns the file (In ...
0
votes
1
answer
399
views
How do I password protect an MVC route with IIS
I want to password protect one of the routes of my MVC 5 app. I don't want to go through the process of Forms Auth or [Authorize] attributes etc. I just want to deploy the app as usual and use IIS to ...
1
vote
1
answer
3k
views
How to format error message from a custom validator
I have created a custom validator this way:
public class IntArrayRequiredAttribute : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext ...
1
vote
1
answer
106
views
Is it really necessary to add .ConfigureAwait call when calling an awaitable method?
I am developing an application using Visual Studio 2019 with code validation.
Some code validation hints are important, however, I am getting a lot of hints in my awaitable method calls, such as
...
-2
votes
1
answer
164
views
create a personalized confirmation message when I click on the Back button of the browser [duplicate]
create custom popup if I want to disconnect (back to the login page) or not, when i click on the Back button of the browser.
1
vote
1
answer
976
views
overriding OnActionExecuting as async
I have a Controller which has OnActionExecuting overridden as async method, this way:
protected override async void OnActionExecuting(ActionExecutingContext filterContext)
{
}
Inside that method I am ...
0
votes
0
answers
719
views
How setup Atommaper v 9.0 in MVC 5?
In a previous project I worked with Automapper v7.0.1 and everything was fine.
Now I am working on a new project and again I made my architecture with MVC 5 and .Net framework 4.8, but I discovered ...
0
votes
1
answer
1k
views
Newtonsoft.Json nuget error, some references do not work
I need help every time I try to use some Newtonsoft.Json configuration, an error appears:
Severity Code Description Project File Line Suppression State Suppression State
Error CS0433 The type "...
1
vote
1
answer
267
views
Entity framework ASP.NET MVC (sometimes) problems with DbContext.Set and elsewhere
I've got a weird problem using ASP.NET in combination with Entity Framework and Unity Container.
This problem only occurs after the application has been running from a few hours to a few days. And ...
-2
votes
3
answers
228
views
online shopping application for add cart
I am developing online shopping purchases application so flow of application is
Add or Remove Item from cart => view item in my cart => then payment option
When click on Remove item from Cart ...
0
votes
1
answer
844
views
When rendering partial view from view jQuery script is not working. When adding the same dynamically it works
I'm adding some functionality to an old project (ASP.NET MVC 5)
In view I render existing items:
@if (Model.ItemsVM != null)
{
for (int i = 0; i < Model.ItemsVM.Count(); i++)
...
1
vote
2
answers
2k
views
secure and hide url and folder from direct download pdf in mvc5
I am developing application for Online Book Purchases
I am giving download PDF Format book after paid money so i want secure my PDF from direct download.
Question:
1) How could I hide folder URL ...
0
votes
0
answers
89
views
asp.net mvc hide download page opening
My case ı have big excel exports ım never stored thıs fıles my server ım create and download client so ı need to keep scope or my export operations is failing my button is this
<input type="button"...
0
votes
1
answer
139
views
Adding a second one-to-one relationship with table Entity Framework 6 fluent api
I've been task with creating a web app using code-first, I've added a first one-to-one relationship which works as I expected, I then added a second one-to-one relationship but can't get it to work.
...
0
votes
1
answer
63
views
MVC EditorTemplate binding not work for 2 elements in same page
My page displays, side by side, to arrays of objects of class ExternalExeWorkerSettings.
To render de objects i created a Editor Template for the 'ExternalExeWorkerSettings'.
The page is correctly ...
1
vote
0
answers
101
views
Is there a native object in the ASP.NET MVC assemblies that give access to the Formatters collection?
In my MVC 5.2.7 project targeting .NET framework 4.6.1, I need to set the Json serializer settings to always to use came case.
So, I want to write in the Application_Start event something like:
...
1
vote
1
answer
2k
views
Error:A local variable named 'Model' cannot be declared in this scope
I m returing a List to the View. So The Model is IEnumerable. It works fine in foreach loop to get the employees. But when I use this Model inside the loop it give me the error:
A local variable ...
0
votes
1
answer
711
views
MvcSitemapProvider.Mvc5 is not working after installation
1) After installing MvcSiteMapProvider.mvc5 via nuget, I get an exception when running my mvc site via localhost and the error stating: Could not find file 'C:\Users...\Documents\Visual Studio 2017\...
0
votes
0
answers
414
views
How to [Authorize] attribute work for authorization with owin token?
How to authorize attribute check token is valid or not?
public class TestController : ApiController
{
[HttpPost]
[Authorize]
public string TestMethod()
{
return "...
1
vote
1
answer
206
views
I try to fetch user information from google api using access_token which provided by mobile end through web api but getting 401 error
How to fetch user information in MVC5 from google API through access_token which token provided by the mobile end into web API?
[Used Code][1]: https://i.sstatic.net/D2hfW.png
HttpClient client = new ...