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.
42,393
questions
0
votes
0
answers
8
views
Enable-Migrations command give and error Exception has been thrown by the target of an invocation
I have one web project and second DAL project which built in .NET Framework 4.7.2
When I am try to run any migration commands using "Package Manager Console"(DAL Project) it give me an error:...
0
votes
1
answer
17
views
Hide button if value is present in child table
I have two tables PK and FK.
PK Table record:- Subject
**SubId** Name
1 XYZ
2 PQR
3 ABC
4 TTR
5 HGF
FK Table record:- Student
StuId Name **SubId**
1 ...
0
votes
0
answers
15
views
SSO in .Net core mvc and .Net standard mvc
I have third party SSO to implement in Two of my companies legacy system's.
One is in .Net standard MVC while second is in .Net core MVC. I have successfully implemented the SSO on .Net core app ...
0
votes
0
answers
33
views
How to use ASP.net login source code on cluster servers
I use asp.net with c# for my simple web form and use following source code for login page
SqlConnection conn = new SqlConnection(conn1);
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
...
0
votes
1
answer
41
views
Azure - App crashed because of Stack Buffer Overrun Exception + HTTP 502 errors
We are stuck with an issue while hosting our application on the Azure app service. Can someone help us to find the root cause of the issue? Also please post if more information is required.
We are ...
0
votes
0
answers
20
views
Email sending working in localhost but when not in published web on server in ASP.NET MVC I am using 587 port
I am trying to send mail from Gmail and it's sent successfully from localhost, but when I publish the website to the server, it didn't send it from there.
Any help?
This is my code - ASP.NET Core 5.0 ...
0
votes
2
answers
76
views
I got Error An unhandled exception occurred while processing the request
i'm newly learning ASP.net Core and i got this error :
I have been searching the solution i internet but didn't get any result. Can anyone help me? this is my code:
Details.cshtml
@model SixthApp....
0
votes
0
answers
33
views
ASP.Net MVC redirect requests to scripts, content routes
I've a MVC4 application and when the user try accessing routes like /scripts and /content, It is returning 403. But I want to return a new custom error page. I tried creating a custom httphandler but ...
2
votes
1
answer
75
views
How do i fill the html field with date in asp.net mvc?
I am building a Todo list application
Model class Todo.cs is as below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
...
0
votes
0
answers
46
views
Http 403 server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature
I generated SAS url with below code
var blobBuilder = new BlobSasBuilder()
{
ExpiresOn = DateTimeOffset.UtcNow.AddDays(2),
Protocol = SasProtocol.Https,
...
-2
votes
0
answers
26
views
Discord api replicating message
I have a discord bot whit whatsapp integration and that bot are replicating the message that the people send to me, whats can I do to resolve that.
I don't have try anything yet because I've never see ...
0
votes
1
answer
21
views
mvc route ignored but correct in route debugger
So I have some jquery posting to a url but comes up as 404
createOrder: function () {
return fetch('/paypalcreate', {
method: 'POST',
...
-1
votes
1
answer
56
views
Copy references to class library ASP.NET
I created a new class library in my project, and moved my Models folder to that. Now I need to get all the references like EntityFramework, DataAnnotations etc to my new class library.
Is there an ...
0
votes
1
answer
67
views
@Html.ActionLink() outside Area ASP.NET MVC
I want to call an Action outside my Admin area, but
@Html.ActionLink("Edit", "Edit", new { id=item.Id }, new {Area=""}) and
@Html.ActionLink("Edit", "Edit&...
2
votes
0
answers
21
views
Set CSS colours from server side
Background
We currently have large client site in Optimizely (ASP.NET MVC) which hosts many, smaller sites, for their regional markets and large, important customers.
Currently, there are various ...
7
votes
2
answers
187
views
Sharing common database between .Net core and .Net standard Identity framework
I have old legacy MVC app that uses Identity 2.0. Also recently I have created .Net 6 API with Identity 6.0 (AspNetCore.Identity.EntityFrameworkCore).
Note: There are some schema related changes in ...
0
votes
1
answer
65
views
Creating multiple project within the same solution
I'm still studying ASP.NET and for the project, I was trying to do a survey system.
So in this solution, there should be two projects with reference to the same model and the database.
One project is ...
0
votes
0
answers
8
views
Ajax Beginform Parameters
I am not getting how to pass my image names form view to action method .I am using ajax Beginform .The problem is,if I don't use ajax beginform ,So much of code changes are required.
'@using (Ajax....
0
votes
1
answer
113
views
I would like to pass the values that i have in my view to a action
I'm developing a school project using a html.beginform to when i click in a button i go to a diferent Action, but i need to pass the values that i have inside my @model.dados2 in the view to the ...
1
vote
1
answer
84
views
I'm using a html.beginform to when i click in a button i go to a diferente Action, but i need to pass the values that i have inside my model aspnet c#
I'm developng a school project using a html.beginform to when i click in a button i go to a diferent Action, but i need to pass the values that i have inside my @model in the view to the action.How ...
0
votes
0
answers
7
views
.net MVC Custom Data Types
Which of the following statements are True regarding Custom Data Types.
A. Custom Data Types are created for a specific Table in SQL Server
B. Custom Data types are created for a specific Database
C. ...
0
votes
1
answer
57
views
How to set default value in dropdownlist from an enum in ASP.NET MVC?
I have a gender enum like this:
my enumlist.cs
public enum Gender
{
[Description("male")]
male= 0,
[Description("female")]
female= 1,
}
But when it is ...
0
votes
0
answers
25
views
Authorization Attribute call on Index method is causing infinity loop
I am trying to use authorization attribute on index method as shown below but it causes an infinity loop of index method call.
[Authorization]
[HttpGet]
public ActionResult Index()
{
//here is ...
0
votes
2
answers
32
views
date edit using guid key
I have used guid as primary key for my table.
namespace entities
{
public class position
{
[Key]
public Guid positionId { get; set; }
public string Name { get; set; }
...
0
votes
0
answers
18
views
A suitable constructor for type could not be located. Startup.cs problem [duplicate]
Trying to understand what I need here. I believe it would be something in my Startup.cs class for dependency injection.. I have a webapp, it calls my .NETCore api . The api has a logger (IEventLogger)...
-1
votes
2
answers
35
views
Id not getting passed to Partial View form
Parent View:
@Html.Action("SetReview", "Review", new {sellerId = Model.SellerId})
[HttpGet]
public ActionResult SetReview(string sellerId)
{
return ...
0
votes
1
answer
35
views
Use or in entity framework
I want to use || in this example:
(from p in DbContext.Posts where p.Name == str || where p.Category == str
select new PostResponse(){
//some properties here
})
but it gives me an error. Any ...
1
vote
2
answers
57
views
how to change color of links in dropdown menu in navbar toggle
My navigation bar has a dropdown menu that looks like this.
when I resize my browser to get the small device version it looks like this.
I want to change the color of links in the dropdown(services) ...
0
votes
0
answers
73
views
how to create and remove dynamics textbox's for phone number with Employee Details and save it in Database in mvc5
I have two tables Employee and Employee_Phone_Number which has one two many relationship means one Employee can have one or more phone number.
I have tried to reach by View Model but not yet.
How I ...
0
votes
1
answer
14
views
contentImage always contains null value
my post.cs file
[Authorize, HttpPost, ValidateInput(false)]
public ActionResult Post(PostView model, HttpPostedFileBase contentImage)
{
return View();
}
My cshtml file code for uploading the image.
...
0
votes
0
answers
38
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 ...
-1
votes
1
answer
64
views
Why HttpServerUtility class is not supported in .Net Core
https://docs.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.
...
0
votes
1
answer
169
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 ...
-1
votes
1
answer
36
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....
0
votes
0
answers
8
views
MVC4 built in Register / login error on PLESK Deployment while working fine on localhost
I am facing trouble in MVC4 internet application which uses built in form authentication. it works fine on localhost but when I try to publish my project on PLESK, Register/Login does not work.
0
votes
0
answers
49
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 ...
0
votes
1
answer
33
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; }
0
votes
1
answer
36
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 ...
0
votes
1
answer
37
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
{
...
2
votes
2
answers
184
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 ...
0
votes
1
answer
33
views
I have a web app working suddenly the page get server Error '/' in application
It was working on esxi server virtual machine windows server 2016 iis
Error is
enter image description here
0
votes
0
answers
13
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&...
0
votes
0
answers
88
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 ...
1
vote
0
answers
14
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 ...
0
votes
0
answers
44
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()
{
...
0
votes
2
answers
179
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 ...
0
votes
0
answers
23
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?
-2
votes
2
answers
55
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 ...
0
votes
0
answers
28
views
MVC Model empty after posting second form back to same controller
I have page that has 2 forms posting back to the same controller
The first form posts back and the result sends back an updated model to allow the second form to appear on the page.
Concept is the ...
0
votes
0
answers
96
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 ...