Questions tagged [asp.net-mvc-5]
ASP.NET MVC 5 is the fifth major version of the ASP.NET Model-View-Controller platform for web applications.
15,658
questions
0
votes
0
answers
15
views
Can not run website in mvc project on Rider (JetBrains)
Does anyone use Rider from JetBrains? I'm creating an ASP.net MVC project like on Pic 1. When I open in browser, it can't run (Pic 2).
I think there might be a port conflict, so I tried changing the ...
0
votes
0
answers
13
views
How create global function for use all views in ASP.NET MVC 5
I am trying to migrate my old web app version to .NET 7, and now like App_Code in previous version, I want to call my helpers from all views.
I found this and write this below one partial view:
@...
0
votes
1
answer
19
views
Allow user to choose download path : MVC 5 Jquery
There might be possibility of duplication...but I didn't get any answer
How can I allow user to select downloadpath while clicking Download button?
I need to use that folder path only in my web ...
0
votes
1
answer
28
views
How to implement .NET Core tutorial to .NET Framework?
I am working on a project in ASP.NET Framework 4.7.2 which uses Azure AD and MSAL to access data from server API within my company. However all the Microsoft tutorials are for .NET Core, and there no ...
0
votes
1
answer
44
views
Getting ObjectDisposedException when IFormFile.CopyTo from another Context
I have an mvc core app that I am uploading and processing an .xlsx document. I want to make the initial POST call, create a new async task to do the processing work, while the post call returns me a ...
0
votes
2
answers
44
views
One to One and One to Many Optional Entity Framework
I have a model like this :
public class PortStackingDetails
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int? ...
0
votes
1
answer
41
views
Loading image using Javascript
My application is MVC5; I am trying to load an image using JavaScript as follows:
<img id="id1" class="img-responsive"/>
var img = new Image();
img.src = "~...
1
vote
1
answer
12
views
MVC5 Validator Error With Date and DateTime in same page
I have a date and a datetime field in my model :
[Display(Name = "Tanggal")]
[Required(ErrorMessage = "Tanggal harus diisi.")]
[DataType(DataType.Date)]
[DisplayFormat(...
0
votes
0
answers
29
views
Linkedin login through owin.security.OpenIdConnect in .net4.7.2 and MVC5 based webapplicaiton
Currently I am working on a website developed using .Net 4.7.2 and MVC5. Received a requirement to implement Linkedin authentication using "OpenIdConnectAuthentication" from owin.security....
0
votes
0
answers
19
views
No ASP.NET MVC 5 Partial Page (Razor) in Add >
I'm supposed to add an ASP.NET MVC 5 partial page (Razor) to my project, I must do this to create a view called LatestTweets.cs.html. When I right-click on Partials > Add > I cannot see any ASP....
0
votes
0
answers
13
views
Attached file issue when sending mail with MVC5
I want to send campaign mail to customers. There is a PDF file attached.
My contact list is an MS SQL table. I used foreach to select each recipient. All emails have an attached file but only the ...
0
votes
0
answers
25
views
Include ENUM in a new ASP.NET MVC project
I've created a new ASP.NET MVC project running on .NET 4.8. I've added classes, controllers, model, interfaces... and it builds properly.
Now I need to create an enum but I'm missing something here. I'...
0
votes
1
answer
38
views
Using EZFontResolver (PDFsharp) throwing an exception when setting it
I'm trying to include a private font into my PDFsharp (v1.51) document drawing process.
I'm using the EZFontResolver as explained here
Here is what I'm doing:
public byte[] GetCertificate(...
0
votes
1
answer
25
views
ASP.NET MVC5 area section override route action
I'm encountering issues on controller routes when using area section. My home controller (located in the main root) has an action result for logout/signout session. I created a "configuration&...
1
vote
2
answers
106
views
How to run an ASP.NET MVC 5 application with .NET framework from VS Code?
It might be a dumb question: I've created a project with Visual Studio using the ASP.NET framework, but I don't have Visual Studio on my work machine, so I'm using Visual Studio Code.
How can I run ...
0
votes
0
answers
38
views
Selecting a Default Option on Load for a .NET MVC Grid
I'm working on an MVC application in .NET 4.5.2 that uses the NonFactors MVC5 grid. Here's a website with the documentation: https://mvc-grid.azurewebsites.net/
I am running into an issue while trying ...
1
vote
0
answers
41
views
ASP.NET MVC 5 - order notification; receive real-time alerts for new customer orders
We have two different applications in ASP.NET MVC 5.
The first application is a website to place an order by user; the user has to sign up to the account to place an order, and the other is the ...
0
votes
2
answers
33
views
authenticate API endpoint with .Net Classic MVC 5 Web App
I have a .Net Classic web app. We are revamping the whole thing, and the frontend is being stripped out and moved to another framework. Some elements of this app will remain, to be ported to .NET Core ...
1
vote
0
answers
64
views
System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent
I have an application that is spitting out tonnes of exceptions to the log and they're all the same
2023-07-06|05:09:34.6824|142|Error|System.Web.HttpException (0x80004005): Server cannot set status ...
0
votes
1
answer
80
views
What is the current ASP.NET MVC replacement for @Html.Serialize and [Deserialize]?
I'm trying to update my ASP.NET MVC 5 web site gradually so I can eventually migrate to ASP.NET MVC Core. I used to put some data in hidden fields and use @Html.Serialize("name", value) it ...
0
votes
0
answers
15
views
How and where do you validate business rules in an Asp.net MVC applicatin?
I'm new to ASP.NET MVC and while developing my first application, I have a few questions.
One is: which is the best way to validate business rules?
In my Edit post method, for example, I check ...
0
votes
1
answer
29
views
How to send AntiForgeryToken with ajax call
In my index view , for each item in the list, there is an actionlink to delete the record. The action link url is of type "/Controller/Delete/id"
When th actionlink is clicked a modal popup ...
0
votes
0
answers
18
views
Html.ValidationSummary display custom validation error message
I have a view (skipping redundant code):
@model ListinoTariffeViewModel
@using (Html.BeginForm())
{
@Html.ValidationSummary(false, "Impossibile salvare. Correggi gli errori:", new { @...
0
votes
0
answers
22
views
Modal form validation issue
I'm experiencing a weird behaviour while validating a modal form.
I try to submit the form twice without entering any value just to test validation.
Validation is server side (I'm not able yet to ...
0
votes
0
answers
28
views
Problem to open two forms in the same modal view
In my application I use the JavaScript\jQuery code below to load two forms in the same modal divs:
View:
$(document).ready(function() {
$.ajaxSetup({
cache: false
});
$.validator....
0
votes
0
answers
24
views
ASP.net mvc with angular js Failed to start 'npm'
I'm Working on Visual Studio 2022.
tried to npm install in node js latest version and also in 14.17.
tried to npm install latest angualr version and aslo tried 8.3.22.
clean cache before installing ...
0
votes
0
answers
10
views
Best practice to implement viewmodel classes?
Suppose you have a model made up of these classes:
public class Employee
{
public int Id { get; set; }
public string SerialNumber { get; set; }
public string Name { get; set; }
public ...
0
votes
0
answers
8
views
Can a DisplayTemplate displays model in different way if it is a singole object or a collection?
I have a ServiceViewModel class.
Someties in my application I have to display a single service, but sometimes I have a list of service.
I use a DisplayTemplate to display the single service in a way ...
0
votes
0
answers
18
views
ASP.NET MVC Unable to post data to server when there are multiple upload controls
I have the following UI where I am telerik controls and posting the data to server
@using (Html.BeginForm("Add", "Storage", FormMethod.Post, new { @id = "frmItem", @class ...
1
vote
0
answers
25
views
Disable server side validation rules for hidden view controls
Which is the proper way to disable validation rule on server side for those controls that are hidden on the client side?
As far as I know, client side validation is automatically disabled for hidden ...
0
votes
0
answers
54
views
Add new row to the view model collection (ASP.NET MVC 5 and EF6)
I would like my Employee edit view looks like the screenshot here:
It's a simplified version of my page, but basically editing an employee means add a new job position (if any) or change the services ...
0
votes
1
answer
56
views
ASP.NET MVC 5 - One View for multiple action methods?
In my application I need three views that shows the same data :Employee details data toghether with employee job positions (job history). They differ only for some buttons.
AS you can see in the ...
1
vote
1
answer
36
views
Default attribute routing not worrking in ASP.NET MVC
I'm trying to use attribute routing in my application. I provided the route attributes to all action methods and also provided the HTTP verbs to the action methods. But I am not able to set the ...
0
votes
0
answers
15
views
How to implement "model entity state changes". My solution
I’d like your opinion about my solution.
I have Employees data imported from an external database.
For the purpose of my application I can only see Employee details, change the Employee’s state (...
0
votes
1
answer
57
views
ASP.NET MVC: How can I redirect to a previous action or a specific action after form submission?
My pages have the form:
site.com/inventory/Query
site.com/inventory/Results
site.com/inventory/Details?item=123
View
On Details, I have a button to upload the item data sheet in the View:
using (...
2
votes
1
answer
65
views
Forcing SnakeCaseNamingStrategy doesn't work in ASP.NET MVC
I'm trying to force both serialization and deserialization to use SnakeCaseNamingStrategy but no luck.
Here is what I have used in Global.asax.cs:
protected void Application_Start() {
...
0
votes
0
answers
41
views
If I have async middleware in ASP.NET Core 6/7 and I am getting 1000 request will there be 1000 threads (created by async) and one main thread? [duplicate]
If I have async middleware in ASP.NET Core 6/7 and I am getting 1000 requests, will there be 1000 threads (created by async) and one main thread?
public async Task InvokeAsync(HttpContext context)
{
...
1
vote
2
answers
76
views
Stored procedure with EF6 Code first - best practice?
In my program I have to import data from a remote sqlserver database.
I am using ASP.NET MVC 5 and EF6 Code First (I'm new with EF and MVC 5).
First, I copy data from a remote view to a table in the ...
0
votes
0
answers
20
views
What causes 'Runtime Error' when using Crystal Report in ASP.NET MVC 5 project?
I have an ASP.NET MVC 5 project and I used Crystal Report in the project. I get this error, it's the first time I've encountered such a thing, I've been dealing with it for a few days, and I couldn't ...
0
votes
0
answers
23
views
Why am I getting errors on all my cshtml files when using Html Helpers in MVC 5?
This is my code I'm getting errors on all of my .cshtml files where I use Html helpers.
@using System.Web.Mvc
@Model IEnumerable<storedprocedrure.PersonalInfo>
@{ Layout = null; }
<html>
...
0
votes
0
answers
86
views
Issue with ASP.NET MVC 5 and Bootstrap 5 Theme
I dont' know why the code generated by VS2022 for MVC 5 project has css class name different from that one used in bootstrap theme.
For validation error, for example, asp.net generate ".field-...
0
votes
0
answers
18
views
How can i bind same column in DbModelBuilder for IdentityUser's two different properties
This is my table
SELECT TOP (1000) [Id]
,[Adi]
,[SoyAdi]
,[Maili]
,[Sifresi]
,[Adresi]
,[Telefonu]
,[KurumAdi]
,[VergiNo]
,[VergiDairesi]
,[...
0
votes
0
answers
15
views
Use different connection strings at Home and Office
I need to connect to a different database location while working at Home than the one used at office.
How can I change connection strings in my asp.net mvc5 code?
Do you think that using Conditional ...
0
votes
1
answer
88
views
jquery pass null to action controller parameter even value not null
I have Action method in controller as below
[HttpPost]
public ActionResult UploadFile(HttpPostedFileBase file, string foldername)
{
string folderpath = "~/...
0
votes
1
answer
47
views
ASP.NET MVC controller upload photo and save folder path
The method I use works on other servers. It works on my computer but not on the server I just rented.
public JsonResult SaveRegesterPhoto(string mImage)
{
if (string.IsNullOrEmpty(mImage))
{ ...
0
votes
0
answers
117
views
Microsoft extension logging with ASP.NET MVC & VB.NET and Unity dependency injection
I'm trying to use Microsoft extension logging in ASP.NET MVC 5 with dependency injection using Unity but its not showing any logs in the console. Here are my complete code,
Global.asax.vb:
Sub ...
0
votes
0
answers
25
views
How to push a notification to flutter app for IOS/android from asp.net mvc 5?
I’m building a car rental flutter application to let the users reserve a car and I'm building an asp.net admin side to accept the reservation or reject it so, I want when the admin takes this action I ...
0
votes
1
answer
19
views
MVC5 [Route] attribute for parameterless endpoint not working
I have an MVC 5 application with an Angular front end.
I am having issues in calling parameterless endpoints.
The MVC application has a controller which the Angular application calls for data.
For ...
1
vote
0
answers
50
views
How can I use Transaction in EF in ASP.NET MVC 5 Clean architecture?
I have read the Clean Architecture Document and eShopOnWeb of Mr. Ardalis and implemented them in my project, ASP.NET MVC5.
Also, I have implemented IUnitOfWork.
I have three layers in my project
...
-1
votes
1
answer
77
views
Singleton or static in class library [closed]
I have an ASP.net MVC 5 web application which is interacting with an external framework, actually it is a web interface for that application. My Application interacts with a wrapper of the SDK (app ...