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.

asp.net-mvc-5
Filter by
Sorted by
Tagged with
0 votes
1 answer
85 views

C# & ASP.NET MVC 5 : optional string in route URL using regex

I'm trying to determine if it's possible to have an optional section of a string in a given route URL using C# and ASP.NET MVC 5. For example: [HttpGet] [Route("~/hot-dogs{withMustard:regex(-with-...
W. Bowley's user avatar
0 votes
0 answers
285 views

Pass route parameter with form submit ASP.NET MVC 5

I am building an ASP.NET MVC 5 application (.NET 4.8) and I'm trying to pass an additional route parameter with form submit to a controller method. Why am I doing it like this? In short, as it is a ...
dzenesiz's user avatar
  • 1,446
0 votes
0 answers
59 views

In ASP.NET MVC 5 view, jQuery weird post method error 404 wrong URL hit issue

I am having a weird issue with ajax post request URL in ASP.NET MVC 5 from Razor view page. My controller is: [Authorize] public class DashboardController : Controller { [HttpPost] public ...
Liakat Hossain's user avatar
0 votes
0 answers
317 views

Issue "This OperationContextScope is being disposed on a different thread than it was created" even without using await in OperationContextScope

I have used below 2 approaches to call external wcf service in mvc 5 project which is using .net framework 4.8. In Approach 1, I'm using await outside of the OperationContextScope block In Approach 2,...
Sravani Yadav's user avatar
0 votes
1 answer
251 views

How to display a video on the site without the user being able to download it in any way. In ASP.Net MVC

I am going to build an educational site where users will not have access to the original video file and will only be able to watch it through the site. Is there a way that the file is not recognized ...
ali aslani's user avatar
1 vote
0 answers
41 views

How can i get original method and uri of request when handling errors in ASP.NET MVC 5

I want to handle all 404 errors with one page which shows method and uri of endpoint , that cause the error . I'he made this controller . public class ErrorController : Controller { public ...
Hovanella's user avatar
1 vote
1 answer
339 views

Clean Architecture in NET Framework 4.5 / 4.7.2

Is it possible to work with clean architecture in ASP.NET MVC 5 on the .NET Framework 4.5 and 4.7.2? I ask the question because I see more examples on .NET Core. Thanks I prefer known work clean ...
Vajra's user avatar
  • 11
1 vote
0 answers
74 views

Migrations not creating all fields from class

I'm using ASP.NET MVC 5. When creating a new migration it is generating the some tables correctly. However, classes like the one below are being generated with almost all of the fields missing in ...
Nick's user avatar
  • 65
0 votes
2 answers
72 views

How to disable a textbox while when we hit edit option in edit.cshtml page in mvc?

====> Here is my edit.cshtml page code: <div class="form-group"> @Html.LabelFor(model => model.Eno, htmlAttributes: new { @class = "control-label col-md-2&...
Nani's user avatar
  • 9
1 vote
0 answers
93 views

C# Picture become black after uploading and then saving it - ASP.NET MVC 5

Please bear with me, my English is still improving... Below given code is what I am using to get an uploaded image saved in "UploadedImage" folder in ASP.NET MVC 5 project. But when I use my ...
Nikhil Rastogi's user avatar
0 votes
0 answers
48 views

ASP.NET MVC 5 connect to multiple databases

I have an ASP.NET MVC 5 project and I want to add multiple databases. All databases have identity tables and I want two work with databases in same controllers. Search in YouTube but not found it
Mohaned 's user avatar
-1 votes
1 answer
34 views

How to create dropdown in MVC using model class and need to display the values(numbers) instead of names?

I tried much applications, but no useful. Can any one help me with this case. For example in dropdown list I have fruits list apple, banana, grape etc .. If I selected apple in dropdown, then I want ...
Nani's user avatar
  • 9
1 vote
1 answer
1k views

Add OpenID Connect to existing ASP.NET MVC in .NET 4.8

I need to enable SSO in an older ASP.NET MVC 5 application built with .NET 4.8. I intend to use Azure Active Directory and OpenID Connect. I've been scouring the web for days, but all of the examples ...
dzenesiz's user avatar
  • 1,446
0 votes
0 answers
41 views

MVC 5 MultiThreading

I'm trying to setup multithreading in a .NET MVC application. I am processing a large amount of data, so my hope is if I split it into multiple threads I can speed up the processing time. The method ...
Andrew's user avatar
  • 2,013
0 votes
0 answers
278 views

ASP.NET MVC 5 IIS web garden every request change Session ID

Session ID changes when I use a Web Garden. A Web Garden is a configuration of IIS that allows multiple worker processes to run simultaneously. The number of worker processes can be specified in the ...
Ahmed Elbatrawy's user avatar
0 votes
0 answers
20 views

Extending User.IsInRole(string role)

I need to extend the User.IsInRole(string role) to account for a WebApplicationId. I have created the following extension method: public static class RoleHelper { public static bool IsUserInRole(...
Andrew's user avatar
  • 2,013
0 votes
1 answer
41 views

jqGrid is not reloading or refreshing properly on keyup event

I needed to create a search page where various types of text, dropdown, date field will be there. i added onkeyup function to every text field so that whenever i put any text or number a grid will ...
Muhammad Nazmul Tanveer's user avatar
0 votes
1 answer
918 views

HTTP 503 error when behind ZScaler corporate proxy and trying to access web app

A couple of days ago our web app started showing a 503 error when trying to access our web app. It works fine when ZScaler is off. This is an old app running .NET MVC 5 on a Windows Server 2012 ...
mati's user avatar
  • 13
1 vote
0 answers
89 views

How to Fix Data hidden in the header and footer section in the PDF generated by Rotativa?

In my ASP.NET MVC 5, I have an index view Containing multiple transaction data. I installed the latest version 1.6.4 of Rotativa via NuGet. Now I can print the index page to a PDF using Rotativa. When ...
Nadeem saleem's user avatar
0 votes
1 answer
774 views

stackexchange redis timeout exception cause website to timeout

I'm using StackExchange NuGet in my ASP.NET MVC website with .NET Framework and when we have some a little more traffic the website cannot load and the request get stuck in IIS and i seee the request ...
Ahmed Kamal's user avatar
1 vote
1 answer
2k views

Package 'Microsoft.AspNet.Mvc 5.2.9 ' was restored using .NetFramework, Version=v4.6.1, instead of the project target framework

I have an ASP.NET Core 6.0 MVC project. I'm trying to add this dll Microsoft.AspNet.Mvc 5.2.9 but I'm getting this below error. Please refer to this screenshot: We are migrating from ASP.NET MVC 5 to ...
Krishna Pandi's user avatar
0 votes
1 answer
217 views

System.IO Exception after IIS deployment

MVC 5 project after IIS deployment on browse returns "Could not load file or assembly 'System.IO' or one of its dependencies". Things I have tried via stackoverflow and googling are Clean &...
ABDUL HAQUE's user avatar
0 votes
1 answer
252 views

could not run the ASP.NET Core MVC application

when i run the ASP.NET Core MVC application from Visual studio 2022, it getting conflicts with source and module file(please refer the attached image.) We are migrating MVC5 project to ASP.NET Core ...
Krishna Pandi's user avatar
0 votes
1 answer
187 views

Redirect to a specific view in ASP.NET MVC 5

I'm sending by email info about my web admin, there is a link whit my controller/view, so when a user click that link the system should to go to login page (I have a page to do it). If the login is ok ...
Cristhian Cobeñas Huamani's user avatar
0 votes
1 answer
923 views

C# iText7 - 'Trailer Not Found' when using PdfReader with PDF string from database

I'm saving the contents of my PDF file (pdfAsString) to the database. File is of type IFormFile (file uploaded by the user). string pdfAsString; using (var reader = new StreamReader(indexModel....
Comand94's user avatar
0 votes
0 answers
34 views

Bootstrap 3 for Razor Html Action List

I made a list with the following MVC5 C# code to create the menu public ActionResult List() { List<Menu> entity = _menuService.List(); List<MenuModel> model ...
Unknown's user avatar
0 votes
0 answers
71 views

ASP.NET MVC: after adding this specific static content mime map not loading any other static file in localhost

I've added mime map for mp4 video to play in published in app service because it was causing an error "file not found". Then I added mime map for mp4 now video is playing, but when I run in ...
Red-Dot's user avatar
  • 57
0 votes
1 answer
279 views

EF6 transaction.Complete() fails giving "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION"

I inherited a small piece of ASP.NET C# code which uses EF6 BulkInsert() to add a number of records (typically 1 to 1000 rows) to a SQL Server table (with only a few fields). It runs a lot and is ...
brit503's user avatar
  • 43
-1 votes
1 answer
234 views

Are there any ways to refresh a partial view without using jQuery in ASP.NET MVC 5

I found a solution to refresh my partial view (a table with some data) using jQuery, calling an action from the controller and changing the view model, when clicking a button, selecting an option from ...
Foreastbtch's user avatar
-1 votes
1 answer
312 views

How to insert view bag list of data to local storage?

as i have multiple checkboxes going to viewbag and getting list of stringfrom selected check boxes. but how can i store them to localstorage? for using to make my filters checked again after submit ...
Yash's user avatar
  • 1
1 vote
1 answer
125 views

Constructor injection of InstancePerRequest to service resolves new instance

I register a service FooRequest as InstancePerRequest in ASP.NET MVC & OWIN: builder.RegisterType<FooRequest>().AsSelf().InstancePerRequest(); After that I resolve FooRequest in two ...
Darth Sonic's user avatar
0 votes
1 answer
39 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). ...
tekf's user avatar
  • 84
0 votes
1 answer
17 views

Perfomance issues in MVC applciation with Sql Server

I have one concern. I already created Views and I called every view in the EDMX file. Now I have a problem with performance. So, I thought I can remove all views from the edmx file and I will add a ...
Vishal Kiri's user avatar
0 votes
0 answers
41 views

ASP.NET MVC 5 Web App Slow Performance with MySQL database and NHibernate

I have an ASP.NET MVC 5 App with MySQL which is hosted on a VPS having 32GB RAM and Quad Core Processor. This is the only app on this VPS. I have tried many ways to improve the performance. Like ...
Usman Nazir's user avatar
0 votes
1 answer
319 views

How to pass a list of data from one partial view to another partial view, when both partial views are contained in a same parent view in ASP.NET MVC?

I have 2 partial views, HeadphonesFilters and HeadphonesList which are both contained inside an Index view which is as follows: <div class="container"> <div class="row"...
Chaitanya Bathia's user avatar
0 votes
1 answer
298 views

How to invoke a parameterized constructor of a MVC Controller?

I have a StoreController, which has to initialize a product repository: public StoreController(IProductRepository productRepository) { this.productRepository = productRepository; ...
Chaitanya Bathia's user avatar
0 votes
1 answer
3k views

Display a modal dialog with an error message when the error is generated in the MVC controller

ASP.NET MVC newbie here. I inherited an old MVC 5 application that I have to fix and extend with some new functionality. The people that worked on it left the company a long time ago and I cannot go ...
Eddie's user avatar
  • 279
-1 votes
1 answer
46 views

Struggling to call a Jscript function within jquery

I have a small MVC5/C# Web application. In short, users will select a location from a dropdown ("#UnitList"). This fires the jquery event, to populate the next dropdown ("#CheckItem&...
ExecChef's user avatar
  • 397
0 votes
0 answers
290 views

IIS ASP.NET - URL Rewrite - FormsAuthentication module fires before RewriteModule module

I have one site and 3 applications in 3 virtual folders and 3 app pools. I use URL rewrite (redirect or rewrite doesn't matter) to catch some wrong urls and rewrite or redirect to appropriate ...
Domagoj's user avatar
  • 11
0 votes
1 answer
63 views

ViewBag Message not displaying in view in mvc5

"New Movie" is not displaying in View. Instead, it is displaying "ViewBag.Message" directly. But the data in ViewModel works fine. NewMovie Action Method: public ViewResult ...
Nora's user avatar
  • 35
2 votes
0 answers
68 views

ASP MVC UrlHelper.Action - high memory allocations

After enabling Azure's Optimization Insights feature on a web app, the majority of its reports are Excessive allocations due to UrlHelper.Action Given MVC5 is a bit long in the tooth at this point, ...
Aaron Hudon's user avatar
  • 5,549
0 votes
1 answer
52 views

will IIS keep track of the parameters sent to a post action method

I have the following Post action method which accept username & password, connect to Active Directory and get the user info in JSON format after validating the credentials: [HttpPost] public ...
John John's user avatar
0 votes
0 answers
307 views

How to pass a parameter to a Post action method which contain "&" inside our ASP.NET MVC 5

I have the following Post action method which accept username & password: [HttpPost] public ActionResult UserInfo(string username, string password) { and I am testing it using FireFox RESTCleint ...
John John's user avatar
0 votes
0 answers
178 views

"return Json(jsonData)" vs "return content (jsonData, "application/json")"

I have this code inside an ASP.NET MVC 5 action method, which serializes an object as JSON using Newtonsoft package: string jsonData = JsonConvert.SerializeObject(result); And I can return the above ...
John John's user avatar
3 votes
1 answer
489 views

What is the minimum permission for a user to be able to connect to Active Directory using DirectoryEntry

We are connecting to Active Directory using this code, inside our ASP.NET MVC 5 app: string ADusername = System.Web.Configuration.WebConfigurationManager.AppSettings["ADUserName"]; string ...
John John's user avatar
0 votes
1 answer
202 views

how we can return a status code for the serialized JSON object using Newtonsoft.net

I have this Action method which act as an API end point inside our ASP.NET MVC-5, where it search for a username and return the username Phone number and Department from Active Directory (we are ...
John John's user avatar
0 votes
1 answer
520 views

Can we use "MembershipProvider" inside ASP.NET Core MVC 3.1

We have the following ASP.NET MVC 5 web application >> and we authenticate the users against an LDAP using this method:- [HttpPost] [AllowAnonymous] [ValidateInput(false)] ...
John John's user avatar
1 vote
0 answers
28 views

How insert increment value after point

On my page, I have two field CLASSID, which is DROP-Down contains value 1,2,3,4,5,... ClassValue, which is TEXTBOX Here is my database record [ClassValue] [nvarchar](5) NOT NULL, Here is my select ...
Veet Thomson's user avatar
0 votes
1 answer
12 views

How can I count the # of items in an associated table that meet certain criteria?

I'm using VS2015, MVC5, and EF 4.5.2. There's a view that displays a paperclip if there are associated documents. I'd like to show the paperclip only if there are associated documents that are marked ...
TLamb's user avatar
  • 147