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
-
3
votes1
answer427
viewsFormat String after it is converted from HTML
I made a code that turns all HTML into a String, however, when doing this the code is coming like this: <div class=\"page\">\r\n<div class=\"bloco\">\r\n <table id=\"canhoto\">\r\n…
-
3
votes1
answer835
viewsWhat is causing Malformad Reference Element in my Signature?
I am trying to sign an XML by passing the tag reference, id, XML and certificate. In a certain situation it doesn’t work, however I never know what situation this is, it is something kind of random.…
-
3
votes3
answers603
viewsProblem sending model to controller
I’m having trouble forwarding my model to control: Class: public class Pessoa { public virtual long Id {get; set;} public virtual string Nome {get; set;} public virtual ETipo Tipo {get; set;} public…
-
3
votes1
answer796
viewsHow to authenticate user via AD or via SQL Server Database
The user has to access via Active Director authenticationy when you are in the premises of the Company and when you are outside the Company the access will be via login and password query in an SQL…
-
3
votes1
answer272
viewsDynamic attributes of an Entity Model
I have a Procedure which returns a number of columns dynamic, because this precedent uses the function Pivot, then the question arises: How to create a Entity Model for this project ?. Example:…
-
3
votes2
answers553
viewsFill Dropdownlistfor dynamically with Jquery?
I’m trying to fill one DropDownListFor dynamically. This DropDownListFor eh to display the cities of the state, for example: The user chooses the state and in this DropDown the cities of that state…
-
3
votes1
answer599
viewsFullcalendar displayed in wrong time
I’m implementing the FullCalendar in a project, I inserted some Events in the database and return them via Json. But when displaying them on the screen, they come with the correct time date, but the…
-
3
votes1
answer691
viewsASP.NET Webforms, MVC or Webapi?
First I would like to point out that my knowledge in web development is very small, so my question will be directed on what to use and not how to use, because the goal is to study first and then…
-
3
votes1
answer143
viewsDoubt with SQL Injection
I have an internal method that is called on the basis of another query, it is this way down. I wonder if this would be a "string.Format" error, if it would be possible to send an Injection SQL?…
-
3
votes2
answers2570
viewsIIS lists directory instead of opening page
I created a website in Visual Studio 2017, clicked to publish it and copied the files to the Inetpub/wwwroot folder However, instead of the page being displayed, the url is returning me to the list…
-
3
votes1
answer66
viewsSimulate a Master/Detail report with foreach
I have a table as follows: public class Producao { string unidade; string profissional; string procedimento; } I can take all the records stored in the table and play them on a list listaProducao.…
-
3
votes2
answers312
viewsC# check "null" or "Nan" or "false" or "0"
I’m having a validation difficulty. I have a View that sends to the Controller information, where in view is used knockoutjs, but there is time that he sends a null or "null" or "NaN" or "false" or…
-
3
votes2
answers95
viewsRecovers data with Request.Querystring
I have a Partial that loads the data: @using (Html.BeginForm("PesquisarEventoPorLocal", "CadastroEvento", FormMethod.Get)) { <div class="row"> <div class="col-sm-12 col-md-12"> <div…
-
3
votes3
answers948
viewsLogout com Identity
I am trying to use the logoff function offered by default in Identity: // POST: /Account/LogOff [HttpPost] [ValidateAntiForgeryToken] public ActionResult LogOff() {…
-
3
votes1
answer26
viewsError running Updade-Database command
When executing the command Update-Database Package Manager Console gets the following error: Value cannot be null. Parameter name: entitySet I have only one model in the project for now public class…
-
3
votes1
answer143
viewsHow to return independent accentuation search on Asp.Net MVC systems
I have a problem in a system in relation to the search that does not return result for accentuation reasons. I would like to know how to make the accent be ignored in the system ? Note the system is…
-
3
votes1
answer58
viewsShow fields of an entity in a different View
I have an entity Academic who owns a Professor, I want in the View details of Academic the teacher responsible for it, i.e. Professor that belongs to that Academic. The code I’m already using is…
-
3
votes1
answer179
viewsMigrations, Updating a null field to not null
I am updating the phone field and CPF of my User entity that was allowing nulls to not nulls. follow the migration file public partial class Required_fild_users_cpf_phone : DbMigration { public…
-
3
votes1
answer323
viewsGroup items in application table Asp.net web MVC
How can I group items into a table? I am bringing these items from the database, I would like to group by the code of the same, for example, if there is repeated code 1 I would like to group it into…
-
3
votes2
answers1242
viewsget return from sql c#
I need to get the return of one select that comes from a procedure. I saw about using the ExecuteReader, but I’m not getting the data that’s coming in. To procedure is fine As the return of…
-
3
votes3
answers8240
viewsFill string with zeros
How to check and fill in a string if its size is less than one condition? For example, I always need to have a string in the size of 8 or 9. If the string is longer I give a substring taking only…
-
3
votes1
answer144
viewsAjax function for MVC controller
I have this function with array and I’m not getting through to the controller values, i listing, it appears correctly, use angular. $scope.addItem = function (user) { $scope.items.push({ de:…
-
3
votes2
answers234
viewsHow can I get the Insert in log with logged in user ? Identity - Asp.net core 2.0
I need to get the logged-in user to log in, thus including which user included in the table, made changes, and delete. I’m learning the language, and I still have many doubts. This is my…
asp.net-mvc entity-framework asp.net-core asp.net-identityasked 6 years, 4 months ago Mariana 2,512 -
3
votes1
answer4561
viewsHow to send FORM values to the Controller in ASP.NET MVC?
I am new to ASP.NET and am creating an MVC application. I have in my controller a method that works as follows: public ActionResult ShowClients(string proc) { --(proc)EXECUTA ALGUMA LOGICA AQUI…
-
3
votes2
answers84
viewsUsing interfaces for domain classes
Is it good practice to make use of domain class interfaces? Do I have an advantage in doing so? If so, which one? Example: public interface IAuditoria { long AuditoriaID { get; set; } string…
-
3
votes0
answers35
viewsApplication in 3 layers X MVC
I was talking to a college roommate and he said something about application in 3 layers, I thought of something like MVC and researching a little more, really this application in 3 layers looks like…
-
3
votes2
answers593
viewsAligning a checkbox component vertically in the center of Row
How do I align a check box vertically in the center of Row? My project is Asp.net core mvc. input[type="text"], select { /*font-size: 13px;*/ } .selectClass { /*font-size: 13px;*/ } label {…
-
3
votes1
answer464
viewsExcel file reading with more than 1 sheet in the same file using C#
In this code I can read all the data of the spreadsheet Plan1 that has the name "Data" of the file ".xls", more if I have more spreadsheet in the same file, as I can read?. Code for reading: static…
-
3
votes1
answer199
viewsHow do I make my form work with reCAPTCHA?
I am saving the data by Ajax, however my reCaptcha is not working properly, the form is sent even without pressing inside the Captcha. My Controller [HttpPost] [CaptchaValidator(PrivateKey=…
-
3
votes3
answers472
viewsAsp mvc how to change model data and move to another view
I’m starting in Asp net mvc and I’m not able to take the changed data from a simple model and move to another view. Follow the codes: Model: public class Produto { public int ProdutoId { get; set; }…
asp.net-mvcasked 6 years, 1 month ago Ton1397 33 -
3
votes2
answers1074
viewsInner Join no entityframework
I need to do an Inner Join on Entity frameworkm in the bank, I can do normally this way: select * from Produtos inner join ProdutosEmpresas on ProdutoID = Produtos.Id But in the Entity framework I…
-
3
votes1
answer77
viewsWhat is the scope of variables on an ASP.NET MVC page?
I have a view layout: <div> <h1>Pagina Principal<h1> </div> <div> <h3>Simular<h3> </div> <div class="row">…
-
3
votes1
answer968
viewsInvalidcastexception: Unable to cast Object of type 'System.Security.Cryptography.Rsacng'
I am trying to pass the PIN through the code, so that the user does not need to enter it always, it is returning me this error: Invalidcastexception: Unable to cast Object of type…
-
3
votes1
answer50
viewsError adding Controler to ASP.NET MVC
A doubt when creating a controller. Because when trying to create it has shown the error of the attached image. I created 3 small classes: Dependentes, Tipobenef, TitularPlano and ProvaContext…
-
3
votes2
answers900
viewsError while trying to add session to startup
I have a problem, always when I will compile the solution this giving error: System.Invalidoperationexception: 'Unable to resolve service for type 'Microsoft.AspNetCore.Session.Isessionstore' while…
c# asp.net-mvc asp.net-core visual-studio-2015 dotnet-cliasked 5 years, 10 months ago Thiago Corrêa 119 -
3
votes3
answers92
viewsLeave date only on the datatime, without the hours part
Hello, I have a project that calls a WebApi which brings the data from the database, but one of the fields in the database is of the type DateTime and in my project, I declared as String (I can…
-
3
votes2
answers70
viewsFor in Javascript with user input
I have a form field that receives a value inteiro, this field in the form has the function OnKeyPress, I need the user to enter some value this value goes to the for ex: the user has typed 5, the…
-
3
votes0
answers136
viewsUpdate all View data via Ajax
I need to update all my data View, i call this function to update, passing the company parameter: function CarregaCaixa() { var Empresa = $("#EmpresaFiltroId").val(); var url =…
-
3
votes1
answer288
viewsReturn View without losing data
I have a code in my controller that makes some procedures, if any of these procedures go wrong, it returns me to view that I desire and in the view I display some messages, this mine view is a view…
-
3
votes1
answer302
viewsC# and Entity Framework with Foreignkey between classes
People in my projects .Net MVC use the structure below. My projects, are with Entity Framework. The briefcase Entidades, are the classes I use in DbContext. Detailing the problem I have the class…
-
3
votes0
answers279
viewsError anti-forgery cookie "__Requestverificationtoken" is not present happens only in Internet Explorer
I have a problem I have no idea how to fix. I have an Asp.net mvc app posted on my machine, where I can use all the features (create, Edit, delete) perfectly, whether in Chrome or IE. It turns out…
-
3
votes1
answer62
viewsDoubt with Viewdata using Asp.net core 2
I made an example for testing using Viewdata, apparently it should work, but it is generating me a reference error, as message below. The type or namespace name 'Student' could not be found I made a…
-
3
votes3
answers125
viewsSave or remove accent on a Textareafor
Hello. I have a Textareafor which receives the HTML content, however when saving the data, the accents and special characters are encoded and I have problems later when editing or viewing the data.…
-
3
votes1
answer81
viewsIs it correct to use an object to call a method where it will be the parameter?
I am creating a small project in without Entity Framework and I have a question at the time of passing an object as parameter, it is correct to pass the same object that calls the method as…
-
2
votes1
answer672
viewsHow do I make Html.Labelfor() display an asterisk in required fields?
I want the required fields (properties with the attribute Required) render with an asterisk indicating that it is a required field. public class Foo { [Required] public string Name { get; set; } }…
-
2
votes1
answer324
viewsHow do I get access_token when I log in with Facebook on MVC5?
When I create a project MVC5 the Visual Studio automatically creates a website for me with option to login by Facebook, Google... Just need to enable in the file "Startup.Auth.cs". But he does the…
-
2
votes3
answers968
viewsHow to run Url.Content via Client?
In ASP.NET MVC it is possible to run the @Url.Content views and controllers. This variable returns the relative level at which the site is. My question is: how to execute the Url.Content via…
-
2
votes1
answer2918
viewsHow to restrict certain file extensions and save to database?
I need to upload images to my database and will use the data type as Bytes in the SQL Server database. How do I guarantee that really would be an image that will be passing to him? I want to leave…
-
2
votes1
answer6871
viewsAuthentication and User Permission with MVC
I’m developing an MVC 3 application, using C# for Models and Controllers and Razor with HTML for Views. I want to implement authentication and user permission to the system. How can I do this using…
-
2
votes1
answer624
viewsSession in a database
Thinking about the scalability of applications developed in Asp.net-mvc, I searched for alternatives not to use "session in memory". I saw that it is possible to save session data in database and…