Most voted "asp.net-mvc" questions
ASP.NET MVC is an open-source Microsoft framework that implements the Model View Controller architecture standards for web development. Based on ASP.NET, it allows software developers to build web applications following the Model View Controller architecture standards, featuring a variety of features following recent trends.
Learn more…3,385 questions
Sort by count of
-
9
votes3
answers1650
viewsHow to make a POST that passes beyond the form, a file?
My question is the following: I can pass to the controller OR the file OR form. I wanted to know if there is any type (like Formcollection, but this apparently only receives the form itself, the…
-
9
votes4
answers2911
viewsEntity Foreign Key Framework
My domain: public class SBE_ST_CorpoDocente { public int Id { get; set; } public string Nome { get; set; } public virtual ICollection<SBE_ST_Curso> Cursos { get; set; } } public class…
-
9
votes3
answers563
viewsWhich application layer is aimed at processing the most extensive and complex business rules?
I’ve been reading some questions and answers about the MVC standard and I saw that they say that the treatment of business rules in the layer is correct Controller, such as: Check if a record…
-
9
votes2
answers326
viewsIs the term ASP.NET MVC correct?
Is it correct to use the term ASP.NET MVC? It seems that they are two different things, like, in MVC we no longer use components of ASP.NET, we use either HTML or Razor or both? I know that besides…
-
9
votes1
answer262
viewsHow could I improve the code of this paging control?
I set up a pagination control for a blog I’m building, but I’m not sure I did it the right way, I tried to copy the pagination control of the Stack Exchange sites. Could you look around and tell me…
-
9
votes2
answers331
viewsHow to implement a "slim" controller
I am working on a prototype of an ASP.NET MVC application, where I want to leave my controller lean (with the least amount of code possible), for such, not making business logic in it, but rather in…
-
9
votes4
answers1255
viewsConverting Httppostedfilebase to byte[] : Exception_wasthrown
Follows code: Controller (with post action): var file = Request.Files[0]; var bytes = ConvertTo.Bytes(file); Convertto class : public static byte[] Bytes(HttpPostedFileBase result) { var length =…
-
8
votes2
answers732
viewsHow to structure a solution by separating Webapi from Webui using ASP.NET Identity?
How should be organized a solution that will have at least three projects, being them: Class Library as infrastructure Web Application as Web Api Web Application MVC for Webui (user interface) Where…
-
8
votes1
answer2897
viewsWhat is Bind(Include = "Property") used for?
By creating a CRUD with scalfold in ASP.NET MVC, in POST, we have the following code: public ActionResult Create([Bind(Include = "Id,Nome")] Grupo grupo) {...} What’s this one used for [Bind]? When…
-
8
votes2
answers539
viewsEntity Framework - Bank Compatibility
I was reading a article that demonstrates the method of using the Entity Framework for connection to Mysql database, however, the article demonstrates techniques quite different from the ones I use.…
-
8
votes2
answers1854
viewsPagination C# MVC Asp . NET
I have a problem with paging performance with Entity Framework and SQL SERVER, first it does getAll and then list the pagination var bdPergunta = new PerguntaRepositorioEF(contexto); var pergunta =…
-
8
votes2
answers339
viewsWhere to put Data Annotation? View Model or Model?
Using Entity Framework Code First, with view model and model. To create a column with varchar(2), need to put the MaxLength(2) in the model and in the view model?…
-
8
votes3
answers576
viewsSession Limitation to Save Data
I have a query slow in Oracle to list all the accesses of a user, so I thought to record the result in a Session, the average of records returned is 600, it’s too much for a Session? Would there be…
-
8
votes1
answer591
viewsChange the naming pattern of views that are generated by scaffold
I would like to change the nomenclature where scaffold generates views: Standard: Create.cshtml Delete.cshtml Details.cshtml Edit.cshtml Index.cshtml I want scaffolding to create that way:…
-
8
votes1
answer374
viewsWhat is ADO.NET for C#?
I’m starting to learn about C# for web applications, and I wanted to know what ADO.NET is and what are the advantages of using it?
-
8
votes2
answers323
viewsWhat is the @ in a view and controller for?
I program in PHP and I’m starting to learn how to program in C# ASP.Net MVC, but I’m having some questions: What is the purpose of @ (arroba) both in controller how much in the view ? What are these…
-
8
votes1
answer3777
viewsWhen should I use Modelstate.Isvalid?
When should I use the ModelState.isValid? Is it only in the insertion of data? And in the case of update and delete? We need?
-
8
votes1
answer1863
viewsEncrypt Web.config
I come here with a question about ConnectionStrings of Web.config. Seeing that normally, we inform a form of authentication on ConnectionStrings for the application to access the database. And by…
-
8
votes1
answer497
viewsWhat is DNX really?
A long time ago I asked here what is the Runtime Environment, especially on the .NET. platform. It turns out that now . NET has DNX which is ". NET Execution Enviroment". In practice we use DNX to…
-
8
votes1
answer1373
viewsHow to handle duplicate key error?
How do I handle duplicate key error? I need to display message to the user that the "Item is already registered" Something like that: try{ //tenta inserir no Banco de Dados…
-
8
votes4
answers542
viewsWhy use block using in ASP.NET MVC?
The block using {} works in the same way in both web applications and desktops in the sense of when we use it in controller? It is a good practice to declare it in the actions that there is contact…
-
8
votes1
answer240
viewsDownload server memory image
I have an Asp.Net MVC project where I have an image in memory and would like to download it. See an excerpt from the code: Image imagem = default(Image); using (Bitmap b = new Bitmap(bitmapWidth,…
-
8
votes1
answer157
viewsHow to use Fluentvalidation ruleset functionality in Web API?
I would like to use a feature of Fluentvalidation calling for ruleset in a web API project, because I don’t want to have to be doing model validation manually every time a action method is called.…
-
8
votes2
answers1332
viewsConvert string to Datetime in LINQ
I have a model where all fields are string. I want to convert to DateTime and Double For that I created a new model public class CPUStats { public DateTime Data { get; set; } public Double? Disco {…
-
8
votes4
answers6487
viewsMaximum request size ASP.Net MVC
I am uploading Image using Jquery. I limited the image to 2mb, but sending a larger image of 2mb shows an exception saying Maximum request size exceeded. That’s what I did: function fileUpload() {…
-
8
votes1
answer356
viewsWeb API and Owin Oauth - redirect to another domain (redirect_uri)
Good afternoon, I’m having a problem implementing external login on a project I’m working on. ASP.NET Web API + Owin + Oauth. Ambience: Work with two Server1 and Server2 servers. Server1: Server…
-
8
votes1
answer1205
viewsDo I need to use Try/catch throughout a process chain?
Supposing I have a call in my layer controller for a method in the business layer that leads to another method in the data access layer. Should I use the try/catch in all of them, only in any or…
-
8
votes2
answers2267
viewsHow Viewmodel works on Asp.net mvc
I have a similar situation that question where I need to save several models at once and relate each. I would need to sort of cascade to first save one entity and then go saving the others, because…
-
8
votes1
answer805
viewsController returning partial view in a modal
I have a button on my screen that held call to a method on my controller (Ajax) that returns a partialView by default. $("#btn-Visualizar-Rotina").click(function() { var codUnimetPcp =…
-
8
votes1
answer377
viewsTo automatically fill fields when saving object in database
I have a system, in ASP.NET MVC which implements a form of audit, that when a user enters or updates an object into the database, some information is saved to an audit table automatically. The…
-
8
votes1
answer809
viewsSimple Injector + Uow + DDD + Multiple Contexts + Entity Framework
I need to know how to apply Ioc to two contexts. The scenario is as follows: I have a Layer called Core (allocates classes that I can reuse in other layers), where I put the interface of Idbcontext,…
-
7
votes3
answers1774
viewsUpdate generating duplicate key error
I have a web application on . net 4.5.1 with MVC and Entity framework. Error occurs in a basic CRUD. I recover the object that will be the model sent to the view with the following code: Professor…
-
7
votes2
answers362
viewsError using File.Delete method within Controller
I’m in trouble in my controller the moment I start a file deletion routine. I am using the method File.Delete(), but he simply does not recognize and returns me the following warning: Cannot Choose…
-
7
votes3
answers6710
viewsCheckboxlist on ASP.NET MVC
I need to create a checkboxlist on my page using MVC (Razor). I noticed that there is no Html helper like Html.Checkboxlistfor or anything like that. Someone has some example of how I could do that.…
-
7
votes4
answers1531
viewsList all Roles in Checkbox and mark the roles that the User has
I am creating an Asp.net MVC 4 User Management System with two Simple Tables. Users and Roles. I can create users by selecting the roles they will own. At the time of Edit I’m trying to List all the…
-
7
votes1
answer541
viewsCustom Roleprovider
I am implementing an authentication with RoleProvider Custom. I have a class Usuario and a class Role with Many to Many relationship. I created a folder in the project called Security and inside the…
-
7
votes3
answers4237
viewsDate field 01/01/0001
I’m with a project Asp.net-mvc3 who owns a View that has a field to receive a type DateTime. In the database this field is required. The problem is that whenever I access the respective View, this…
-
7
votes2
answers1076
viewsHow to put a @ inside {} in MVC
While doing a MVC5 page with Razor, I went to put the following code {--conteúdo da @ RenderBody() etc, etc } Generated an error because the @ is inside keys ERROR: Server Error in '/' Application.…
-
7
votes1
answer575
viewsDisplay Facebook images with a certain hashtag via API
I am developing a web application, and my client asked me about appearing in his application, in some area of the site, images of Facebook, with the desired hashtag. Example, it will cover a certain…
-
7
votes3
answers233
viewsnullable on the models?
What is nullable for in a model? For example: public int? ProjectId; If I put it this way I’m accepting null values, right? And if I put the required Annotation in the property, being required it…
-
7
votes1
answer2089
viewsQueries in Asp.net mvc with Entity framework
I’m starting a project in ASP.NET MVC 5 with Entity Framework 6, along with studies in mvc. This to have a better learning, and I came across the following doubt. In the controller have the method…
-
7
votes1
answer1275
viewsHow to save formatted text to database
I’m using Tinymce to edit texts on my website. However, I am doubtful to save the formatted text in the database and then display it the way the user typed it. (paragraphs, font color, etc.). Is…
-
7
votes3
answers1618
viewsHow to intercept exceptions when working with the Entity Framework?
I want to handle errors returned by Entity Framework. In this example I am forcing the insertion of a duplicate record (Name already existing in the database and the table column is configured as a…
-
7
votes2
answers297
viewsBest way to do an Action that does not return data
I am making an ajax call to change an object. The call does not need to return anything. Only http 200 (OK) or 500 (error) code. I’m using the following code in the action but I don’t know if it’s…
-
7
votes2
answers468
viewsWhat is the equivalent of if($_POST) on . Net (ASP.Net MVC)?
I’m coding a page in Visual Studio, in ASP.Net MVC and I need to display one div only when there is a POST on this page. This is a form that will make the POST on the page itself. When POST, I will…
asp.net-mvcasked 10 years, 2 months ago Felipe 427 -
7
votes1
answer7986
viewsHow to make return with Ajax Beginform
I have my Form with the following statement: @using (Ajax.BeginForm("Novo","Cliente", new AjaxOptions { OnSuccess = "OnSuccess", OnFailure = "OnFailure" })) { } My duties in the js: function…
asp.net-mvcasked 10 years, 1 month ago Rod 9,412 -
7
votes1
answer1457
viewsHow to use multiple models in a view
I’m doing a criminal record and I have the following models: Pessoa Fisica Juridica And in the code of mine view I have only the declaration of a model: @model CodeFirst.Models.Fisica The problem is…
-
7
votes1
answer11539
viewsHow to Create Dropdownlist in ASP.NET MVC 4
You could help me create a DropDownList on MVC4? I have the class ProjetoFuncionario which is an associative class of Projeto and Funcionario. I must create a class for Dropdown? I’m having a hard…
-
7
votes2
answers2701
viewsWhich is more secure: Session or cookie?
Thinking about security guard, what is the best option to keep the user logged in an ASP.NET MVC application, the cookie or the Session?
-
7
votes1
answer898
viewsIs it correct to save multiple entities at the same time in the ASP.NET MVC Controller?
I need to save 12 entities in the same method, in the Controller, I don’t know if I’m doing it right. In my method Create of Controller, call all entities and add all attributes in the same View. By…