Questions tagged [asp.net-mvc-4]

ASP.NET MVC 4 is the fourth major version of the ASP.NET Model-View-Controller platform for web applications.

asp.net-mvc-4
Filter by
Sorted by
Tagged with
0 votes
0 answers
279 views

How do I read the content of a file from the URL?

I have the URL to a shared FileCloud in my database. I want to change it with content of a shared file. How can I read the content from the URL? I used this code to try but it doesn't read the content ...
Qusay's user avatar
  • 1
0 votes
1 answer
2k views

Why HttpServerUtility class is not supported in .Net Core

https://learn.microsoft.com/en-us/dotnet/api/system.web.httpserverutility?view=netframework-4.8 As mentioned in the preceding link, the HttpServerUtility class is only supported in .NetFramework. ...
Vimal_Adhikari's user avatar
1 vote
1 answer
3k views

Where is the Program.cs or Startup.cs file in asp.net?

I am trying to do an online library(as in an online book store) using ASP.NET MVC. I can't find the Program.cs file or the Startup.cs file. I tried manually creating the Program.cs file but when I ...
Mucileanu Andreea-Luiza's user avatar
-1 votes
1 answer
51 views

Errro login in asp.net

I am trying to make a login in asp.net but the values I am entering are not being taken. I have the following lines of code: [HttpPost] public ActionResult Index(Usuarios log) { var usuario= db....
Jaiver's user avatar
  • 1
0 votes
0 answers
64 views

Why am I receiving an ArrayTypeMismatchException error despite the providing the current return type?

I am trying to add an item to a List. However everytime I try to add something to that list I face an ArrayTypeMismatchException error with the error message being "Attempted to access an element ...
Kaustav Dutta's user avatar
1 vote
1 answer
283 views

How to create custom HtmlHelper for nullable Boolean radio button group in .NET Core

Trying to make a custom MVC control [Display(Name = "Do you agree?")] [Required] public bool? Agree { get; set; }
Murometz80's user avatar
0 votes
1 answer
113 views

Searching string value for different formats from the Database Table

In my ASP.NET MVC application, I want to search and get data from the database once users search the value. Example User type BCD-1254 from the view. In Database, the record could be saved in ...
Dev Beginner 's user avatar
0 votes
1 answer
319 views

Get the Total and pass to View Model

In my ASP.NET MVC application, I want to create a view of request details and the Total Amount that each request has. This is how I create my View Model public class ApprovedMedicals { ...
Dev Beginner 's user avatar
2 votes
2 answers
5k views

.Net MVC 5 Multi-Select List Box

I'm trying to create a multi-select box and so far tried many things. public class DepartmentDropDown { public int Id { get; set; } public string Name { get; set; } } public class ...
AsIndeed's user avatar
  • 137
0 votes
0 answers
17 views

how to refer base methods in inherited class without advancing to the next line if redirect occurs

I have an Index controller, where i check if the logged-in user is an admin or not: public ActionResult Index() { if (Session["Admin"].ToString() != "True&...
Ronald Anthonisamy's user avatar
0 votes
0 answers
335 views

ASP .NET MVC 4 dependency injection "No parameterless constructor defined for this object"

I am trying to inject IProfileService into controller constructor but I am getting error "No parameterless constructor defined for this object" when calling that controller. If I add ...
forrestDumb's user avatar
1 vote
0 answers
18 views

before calling application _ start event database has been created?

I want to know before asp call this method , database has been created and is ready? you know this method run when someone visit website for first time. if someone visit the site its mean website has ...
user avatar
0 votes
0 answers
166 views

Application_Start ()

I want to know before calling this event ( Application Start) . database has been created? public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { ...
user avatar
-1 votes
2 answers
1k views

How to pass selected bootstrap dropdown value to the controller in ASP.NET MVC

I inherited this code base in which I need to pass extra property to the controller. This field happens to be a select dropdown for users to select yes or no. I need to pass that value to the ...
techstack's user avatar
  • 1,417
0 votes
0 answers
27 views

Seed method in migrations

I want to know Seed method in configuration (migrations) is run when the database is created, right? Can I use it to add some data to the database after it has been created?
user avatar
-2 votes
2 answers
91 views

Returning a method for a form

I have a form which after clicking Submit should call the AddProduct method View @using (Html.BeginForm("AddProduct", "Home", FormMethod.Post)) The problem is the controller. Has ...
DeveloperApps's user avatar
1 vote
0 answers
2k views

Asp.Net HttpContext does not contain a definition for SignInAsync

I'm having to work with an old mvc project in asp.net 4.6.1 and I'm trying to add a login feature. But there's an error with the HttpContext part, it says: "HttpContextBase does not contain a ...
Fernando Pereira's user avatar
0 votes
0 answers
630 views

Some pdf attachments showed as octet-stream in database

In my ASP.NET MVC web application, I have given the option to users to attached PDF files or JPEG files in the view. So once the user uploads the file I'm saving those files by considering file type. ...
Dev Beginner 's user avatar
0 votes
1 answer
732 views

Rest APi How to route based api versioning

I have a method called GetMessage, it is called like so: localhost/GetMessage?id={{NewMessage}} i have now decided to start following standard practises and ommit the "get" keyword from the ...
Prime's user avatar
  • 130
0 votes
1 answer
1k views

Getting 404 not found error for service(.svc) endpoints in Asp.net web application deployed on azure app service

I have a ASP.net web application in which I'm calling service endpoints like "https://webapp.azurewebsites.net/Services/DataServices.svc/GetSalesOrders" to retrieve data and do CRUD ...
Mradul Karmodiya's user avatar
0 votes
1 answer
172 views

How I download two different extensions files without opening in the browser?

I am uploading .doc/docx or .pdf files and I want it to download without opening it in to the browser. if(file1 == null) { ModelState.AddModelError("CustomError", ...
Muhammad Muzammil's user avatar
1 vote
1 answer
668 views

Twilio incoming call refresh the page call disconnected with browser

We are using the Twilio call feature in our product and we currently are facing an issue with Calling. When an incoming call is ringing on the browser and lets say the web app is opened in multiple ...
Muhammad Umar's user avatar
1 vote
1 answer
1k views

complex web.config transform for different stages in DevOps release pipeline

I am new to Azure DevOps and setting up Azure DevOps CI-CD pipeline. Our project solution contains multiple projects including older version of .Net web forms, MVC, APIs, .NetCore projects. web.config ...
Mousam's user avatar
  • 215
0 votes
0 answers
179 views

Updating parent model and all children

I am creating a simple WebApi for Recipes. A recipe contains both ingredients and instructions. I think I got most of the WebApi down, except for the Update() part. I am not quite sure if I am doing ...
John Doe's user avatar
0 votes
0 answers
386 views

Why my Chart.js doesn't update and display in html? ASP.NET MVC using SignalR

I am new and I want to update and display my chart.js in HTML with data got from my database using sinalr script. I used alert and it has value but still nothing in my chart. Can you check and show me ...
huyen huyen's user avatar
1 vote
1 answer
338 views

Joining column with multiple tables LINQ

There is a table I want to join with different columns in different tables. This is how so far I did this var purchData = (from a in db.AppRequest join e in db.Employee on a.Req_By equals e.Id join c ...
Dev Beginner 's user avatar
0 votes
1 answer
653 views

Partial View data is not display in it

I am trying to display countrywise employee details using partial view... It is basically called the Partial view but did not display data in it. Here is my INDEX PAGE CODE <select class="...
Veet Thomson's user avatar
0 votes
0 answers
661 views

Push notifications with Azure Push Notifications in ASP.NET

For my ASP.NET MVC web application, to send the push notifications among the users I have used SignalR + Firebase. And I have published my application and hosted it in the Azure service. As a Database ...
Dev Beginner 's user avatar
0 votes
0 answers
483 views

context is null after adding new column/property

I've been modifying my existing project in mvc-c# and add a new column in one my tables. Now, I modified my model and add this column polads [Table("media_order_headers")] public class ...
Monsur MonPaulo's user avatar
2 votes
2 answers
2k views

Pass model data to javascript function

I have this model @model WebApplication1.Models.Person which has an Id data. I want to pass Id to a javascript function via <a href="#" onclick=myFunction(idGoesHere)>. I tried putting ...
EL02's user avatar
  • 302
0 votes
1 answer
1k views

How can we implement multiple custom action filters in web api?

How can we implement multiple custom action filters in web api? public class FileValidationAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context)...
Raj Kumar's user avatar
0 votes
1 answer
559 views

c# append slash to the path parameter

I need to add dot (.) in path parameter and it turns out that dot will only work if we append a / slash at the end of that parameter. For example: /api/path.param/?q=123 this will work However: /api/...
rfa's user avatar
  • 13
1 vote
0 answers
96 views

Add support for AD authentication on a MVC 4 application

I have a big MVC 4 application that uses Form authentication. It has its own user and privileges management using a custom database. Now I need to adapt this application to allow integration with ...
WaveMax's user avatar
  • 191
0 votes
0 answers
2k views

LINQ Expression can not be translated

I used the following calculation to calculated DaysPastDue. The calculation is working fine, I get the right result but when I filter record by DaysPastDue I get could not be translated. Either ...
kuka muk's user avatar
  • 349
0 votes
1 answer
642 views

Object reference not set to an instance of an object. MVC and Foreign Key

I tried everything and nothing! I get an error: System.NullReferenceException: 'Object reference not set to an instance of an object.' Maybe it's because I use two foreign keys of the same class? I ...
Eduardo Henrique's user avatar
0 votes
1 answer
82 views

SQL Server query: Uncaught TypeError: content is null

What I am trying to do, is query from my database and populate the columns inside my Index.cshtml. Below is my code: This is from my HomeController: SqlConnection con = new SqlConnection("Data ...
yongchang's user avatar
  • 523
0 votes
0 answers
510 views

Application has intermittent connection errors when connecting to SQL Server

We have an MVC4 application hosted on a VM server that uses an entityframework style connection string to connect to an instance of SQL server hosted on another VM server on the same ESX host, both ...
Paul's user avatar
  • 1,145
1 vote
0 answers
88 views

passing repeated input elements values to controller

I have a form where there are repeated input elements. For creating repeating elements I took reference from, Dynamically repeat and remove form elements using JQuery. In the form, there is text box ...
user4221591's user avatar
  • 2,100
3 votes
2 answers
3k views

Visual Studio 2022 "Arithmetic operation resulted in an overflow" Error on MVC 4 Project

I'm developing my old MVC 4 project on Visual Studio 2022. But when I try to "add view" or "add area", "Arithmetic operation resulted in an overflow" error occurs. It ...
Yılmaz DALKIRAN's user avatar
-1 votes
1 answer
455 views

Enum value to checkbox in MVC C#

I am am working on one feature roles and permissions. i want to give best work on this. i have some doubt. My Enum Class is public enum Roles { UserCreate = 1, UserEdit = 2, ...
P Mahesh's user avatar
3 votes
1 answer
1k views

How to show "go to controller" in page view (cshtml) in VS 2022?

I'm using the MVC pattern for web development. After updating to the 2022 version, I can no longer find the "go to controller" tool in the context menu in the page views (.cshtml). Can ...
Q.thanh's user avatar
  • 41
1 vote
1 answer
64 views

Creating dropdowns according to the database

There are different properties for 3 (x,y,z) properties in my database. I created a dropdown and according to the selection I will make in the dropdown, I want to bring the properties belonging to ...
user avatar
0 votes
0 answers
556 views

updated data not loading in datatable only showing after doing F5 in ajax jquery mvc form

I have a cshtml page where I have datatable to display the data and a bootstrap pop up form via which I am doing insert and update operation. When the page loads, the data is displayed in datatable ...
user4221591's user avatar
  • 2,100
1 vote
1 answer
81 views

C# Owin Auth - Common Token for the Webite and API

I have implemented the Owin Auth token approach in Web API(C#). The question is, Can I use a common token for both Mobile App and the Website ? If I create a token from the website and with this token ...
Vikas Lalkiya's user avatar
-1 votes
1 answer
726 views

How to fix asynchronous module or handler completed while an asynchronous operation was still pending

I have this custom authorization when accessing a controller but I keep getting the following the above error: Can anyone help me to identify the issue in my code? //Controller [...
Fernando Nicolalde's user avatar
1 vote
1 answer
521 views

In ASP.Net MVC with .Net Framework 4.X, how do you add keys to web.config during the deployment pipeline?

With .NET 6 or .NET Core I can easily plug settings, connection strings, etc with environment variables, AWS Key Vault and so on. How do I do that in .Net Framework 4.X? I want to add settings in my ...
Rodrigo Lira's user avatar
  • 1,529
2 votes
1 answer
1k views

How to post data to rest api in ASP.NET MVC?

I am newbie to ASP.NET MVC, this is my first project, for login I'm using SSO and I find it difficult to post data to get the return from rest api. Before migrating to ASP.NET, I used php (codeigniter)...
Frank Andrew's user avatar
1 vote
1 answer
370 views

ASP.NET MVC : Actionlink does not navigate to correct action method of same name but different parameters

I have two action methods with same name. And they both are decorated with the Http verbs 'Get' and 'Post', and also their parameter list is different. [HttpGet] public ActionResult Transaction() [...
Jashvita's user avatar
  • 591
1 vote
1 answer
382 views

Using OAuth2 in C# MVC result from google fails with null principle

The goal is to implement OAuth2 against Google in a C# MVC app using .NET6. The result I get shows failed in the result.Succeeded field and all values are null. I'm sending the correct google client ...
Dan Hass's user avatar
0 votes
1 answer
381 views

Translate result of DbDataReader to database model in ASP.NET MVC 4, coming from a stored procedure using ADO.NET [duplicate]

I have a user-defined stored procedure which returns multiple actual tables as result set: CREATE PROCEDURE uspDemo (@UserID BIGINT = 0, @IsAdmin BIT = 0, @Title VARCHAR(120) = '') AS ...
MANISH SHARMA's user avatar

1
4 5
6
7 8
849