Click here to Skip to main content
15,891,700 members
Everything / MVC / MVC6

MVC6

MVC6

Great Reads

by Bart-Jan Brouwer
.Net Core datagrid with server side paging, sorting and filtering
by Shashangka Shekhar
In this article, we will focus on how to enable CORS in ASP.NET Core application, get knowledge about CORS policy how we can share resource through different origin.
by Fiyaz Hasan
This article shows you how to configure the ASP.NET Core 2.0 MVC File action result to write file to response with cache headers.
by Troy W. Locke
Setting up and using the new configuration system in ASP.NET 5 vNext

Latest Articles

by dnxit
Seeding data in MVC 6 .NET Core 2.2 application at startup
by Member 13353000
How to upload images on MVC Web App razor pages using ASP.NET Core 2.2
by Yogi S.
Tutorial on implementing OpenWeatherMap API in ASP.NET MVC. It will teach how to get real time weather data of any city of the world.
by Vincent Maverick Durano
This article demonstrates how to build an ASP.NET Core application using Entity Framework Core Code-First development with Web API and MVC.

All Articles

Sort by Score

MVC6 

8 Aug 2016 by Wonde Tadesse
I see you are dealing with MVC6 (as it shown in the question tag). Server.MapPath may not work. You need to deal with IApplicationEnvironment interface, namespace Microsoft.Extensions.PlatformAbstractions to get the server path. Something like private readonly IApplicationEnvironment...
18 Jan 2017 by Bart-Jan Brouwer
.Net Core datagrid with server side paging, sorting and filtering
8 Aug 2016 by Dave Kreskowiak
When a user uploads a file it doesn't go to any directory. It's still sitting in the Request object, in the Files collection. It's up to you to get the content and save the files somewhere appropriate.See this[^] for an example.
27 Oct 2016 by Shashangka Shekhar
In this article, we will focus on how to enable CORS in ASP.NET Core application, get knowledge about CORS policy how we can share resource through different origin.
20 Jul 2017 by Fiyaz Hasan
This article shows you how to configure the ASP.NET Core 2.0 MVC File action result to write file to response with cache headers.
28 Feb 2016 by Troy W. Locke
Setting up and using the new configuration system in ASP.NET 5 vNext
8 Jun 2016 by amitthk
Cross platform Asp.Net Core RC2 with Angular 2 - getting started on Linux/Mac & VSCode - Part 1
5 Jul 2016 by Rion Williams
Cache Rules Everything Around Me: Using ASP.NET MVC6 TagHelpers to Bust Cache
13 Sep 2021 by OriginalGriff
Excel has limitations: Excel specifications and limits[^] - specifically in your case it is limited to a maximum of 1,048,576 rows by 16,384 columns per sheet. There is no way round that, and while it is possible to break your data into multiple...
26 Nov 2015 by Krunal Rohit
- Html.Partial returns a string, Html.RenderPartial returns void.- We can store the output of Html.Partial in a variable/able to return from function.- In Html.RenderPartial, we can’t result void.(ie.,directly writing to the output stream so it was bit faster than...
16 Jan 2016 by Dave Kreskowiak
Don't you think it would be a better idea to ask this question in a forum dedicated to Orchard CMS[^]?
14 Apr 2016 by F-ES Sitecore
Some classespublic class FileUpload{ public int ID { get; set; } public string Filename { get; set; }}public class UploadModel{ public List Files { get; set; }}The view@model UploadModel@if (Model.Files.Any()){ ...
9 May 2016 by Karthik_Mahalingam
customize it based on your need using css[^] function showbaloon(elem) { elem.style.display = "block"; } function hidebaloon(elem) { ...
6 Jun 2017 by Kornfeld Eliyahu Peter
You can not... Even you have an application to display any possible file format, and even all those applications properly registered with your browser, and even all those applications has a plugin to display files INSIDE the browser, the user still can rule the option out and force download......
20 Nov 2017 by Richard Deeming
Entity Framework Loading Related Entities[^] You have two options: 1) Lazy Loading (Not recommended) Make your collection and navigation properties virtual, and Entity Framework will create dynamic proxies for your entities, which will be able to load the related entities dynamically on...
10 May 2018 by Dave Kreskowiak
I have no idea what you're talking about, but I'm going to take a guess at what you mean. No, you cannot user 2 different versions of Bootstrap in the same page at the same time.
9 May 2019 by Member 13353000
How to upload images on MVC Web App razor pages using ASP.NET Core 2.2
13 Sep 2021 by BillWoodruff
Even using Excel 64-bit (which is not limited to 2 gb.) on a high-end cpu workstation loaded with RAM you can't do this. fyi: Excel 64 can address up to 8 terabytes of memory ... that does not mean you can use that much memory ! The limits...
23 Aug 2023 by OriginalGriff
Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead. When you concatenate strings, you cause...
12 Oct 2023 by Graeme_Grant
This should answer your question: Dynamically assigning asp-for variables[^]. Here is the Google search used: asp.net dynamic asp-for - Google[^] UPDATE This may help: Creating dynamic forms with .net.core[^] and the Google search used:...
15 Apr 2024 by Dave Kreskowiak
Quote: i set the idle timeout for 2 minutes, ... then the session getting expired in 2 minutes It's doing exactly what you told it to do! You said expire the session in 2 minutes, so the session is expiring in 2 minutes. What did you think was...
23 Dec 2014 by WaterFountain
The code for my android application is below and so far I'm happy with it. Before anyone comments, I do acknowledge it requires the addition of further validation. The android application is a login system which makes use of SQLite to store login information such as usernames and passwords for...
8 Oct 2015 by Sohaib Javed
I Need to have a complete idea about Asp.Net MVC 6 Default Account Controller methods. Where Can I get that complete article? I went through this article but it doesn't explain all Customizing ASP.NET Identity System for Authentication and AuthorizationI need to understand that decorations...
8 Oct 2015 by Nathan Minier
Moving this to answer, since I have a fair amount to throw at you.So I've got a couple of resources for you. The first is a more basic "How To" on using forms authentication:http://www.codeproject.com/Articles/578374/AplusBeginner-27splusTutorialplusonplusCustomplusFAnd a more advanced...
11 Oct 2015 by Ali Saleem
IF you a newbie to MVC, and if you wanna be a fish catcher rather a man who always rely on others help and for the detail knowledge of MVC I recommend you to have a look on https://www.microsoftvirtualacademy.com/search/SearchResults.aspx?q=mvc orImplementing Entity Framework with...
7 Jan 2016 by itsathere
I want to load multiple charts on every button click event.I have used below google code google.charts.load('current', { 'packages': ['corechart'] }); ...
28 Feb 2016 by Er. Puneet Goel
When you are dealing with Date&Time input from user, it's always complicated to handle the Date&Time format. You are not sure about how you will handle the user input format. So, here is the solution.
28 Feb 2016 by F-ES Sitecore
Use the url rewriting module to map your old urls to new onesURL Rewrite : The Official Microsoft IIS Site[^]
21 Mar 2016 by deepankarbhatnagar
Hi please look into these links below for your help: thanks in advanceASP.NET 5 MVC6 Dependency Injection in 6 Steps | .NET Liberty[^]Dependency Injection — ASP.NET documentation[^]
8 May 2016 by P_Z
In JavaScript/jQuery you can code similar to:$(document).ready(function() { var url = window.location.href; $('#textboxid').val(url);});
9 May 2016 by Nathan Minier
You'll want to switch from forms to windows authentication and deny anonymous users. This should open a login...
29 Jul 2016 by Suvabrata Roy
Hi,Fltimg { float: left;}Set this class to images which you want to show side by side.
1 Aug 2016 by VICK
Ever heard of using jQuery plugins for such kind of work?Well there are plenty of plugins available to show your bunch of images as tiles.One of the good plugin is available on the following link.FreewallYou may use the above mentioned plugin or can google for the related...
5 Sep 2016 by Richard Deeming
Debug your code and examine the DataSet. You will see that the first table only has a single column - states_Id. The data you're trying to read is in the second table.public List ReturnListOfProducts(){ string xmlData =...
20 Sep 2016 by Karthik_Mahalingam
check this var json = [ { parent: '1', item: 'Electronics' }, { parent: '0', item: 'Play station' }, { parent: '0',...
23 Sep 2016 by Karthik_Mahalingam
try thiseventAfterAllRender: function () { var map ={Sun:'City1',Mon:'City2',Tue:'City3',Wed:'City4',Thu:'City5',Fri:'City6',Sat:'City7'}; $('.fc-widget-header th').each(function (i,elem) { var newText = map[$(elem).text()]; ...
8 Oct 2016 by ahmed_sa
In edit HTTP post i need to remove courses stored in ids variablenote i need remove courses selected not edithttp://www.mediafire.com/view/awe5t3xlh6ghbgx/remove_ids_courses.jpg[^]in jquery i store values of removed courses in ids variablesuppose i removed photoshop and flash it...
14 Dec 2016 by Dave Kreskowiak
Why are you asking us, a bunch of people who have never heard of ABP Boilerplate?Ask in a forum dedicated to the library you're using, here[^]. See that little "Forum" link at the top of the window? Click it and ask your question in there.
14 Dec 2016 by Dave Kreskowiak
Only YOU doing the research into any templates is going to answer your own question. You're the one with all the requirements. There's a ton of templates out there and only YOU know all of your requirements, likes, and dislikes. Only YOU are going to be able to say which one is "the best".
22 Dec 2016 by F-ES Sitecore
1. Be a .net developer for 5 years.2. Do interview.
4 Feb 2017 by Dave Kreskowiak
There is nothing built into ASP.NET or the .NET Framework that will do this for you. You have to implement an appropriate solution to this problem yourself.One idea would be a state machine that you save to a database to track this and to reload on the next request to check the state the...
9 Feb 2017 by njammy
You do not need two separate action methods.Just define one, with all the parameters required, and fire a AJAX event as the user controls to the same action. This action will return the pre-set number of records per user event i.e. scrolling 60px.You don't need to run it multiple times, just...
24 May 2017 by OriginalGriff
The code you show puts a formated string version of yesterday's date into FromDateString - it can't do anything else, and will do so every time you execute that code. And there is the rub: for FromDateString to be null means that you haven't executed that code at all! Why not? We don't know -...
14 Jun 2017 by Kornfeld Eliyahu Peter
14 Jun 2017 by Patrice T
Quote: As per my assumption it allows A-Z, a-z ,0-9 and spacial characters like Back slash, Single Quote, and Hyphen. Your RegEx is a little more complex than that, looks like your problem is that you use RegEx without really learning it. Use last link and paste the RegEx and you will see a...
5 Jul 2017 by Karthik_Mahalingam
Corrections @using (Html.BeginForm("UserReportView", "HomeController", FormMethod.Post))
9 Aug 2017 by F-ES Sitecore
That's a javascript error and javascript runs off what is sent to the browser (not what is in your cshtml file) so look at the page source. var path = '@Url.Action("index","Survey")?id=' + @Model.MyGuid+'&languageName=' +selectedValue; alert(path.val()); The above will...
5 Sep 2017 by Kornfeld Eliyahu Peter
What are you talking about is called Single Page Application (SPA)... You can use MVC to create such an application (there are templates in VS for that), however you should consider if SPA fits your application at all...
9 Nov 2017 by Suvendu Shekhar Giri
Short Answer: private string GetUserIP() { string ipList = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(ipList)) { return ipList.Split(',')[0]; } return Request.ServerVariables["REMOTE_ADDR"]; } ...
9 Nov 2017 by OriginalGriff
Check where your dev server is: normally in development it's on your machine, so it will indeed have the same IP address as the client! Be aware that in web applications, the IP address will not be individual to a client computer - it will be the IP of the router via which he connects, so an...
21 Nov 2017 by Sascha Lefèvre
Please see my in-code comments: if (uList.Count > 0 && uUserLog.Count
22 Nov 2017 by F-ES Sitecore
use "JSON", it is case-sensitive. JSON.stringify(Model)
25 Jul 2018 by Richard Deeming
IDs in an HTML document need to be unique. You are assigning the same ID to the hidden input in each row. You are also assigning the same ID to each button. There's also no point adding an onclick attribute to the button if you're simply going to cancel that handler elsewhere. Change your...
15 May 2019 by TheRealSteveJudge
There is a free toolkit for it: WebDataRocks | Free Web Reporting Tool[^] Integration with AngularJs is described here Integrate web pivot table with AngularJS | WebDataRocks[^]
28 Jan 2020 by Member 12680671
Hi Check out M J Kan's blog , I have downloaded his code and it works Migrating Rest API with Swagger & URL based versioning from Asp.Net core 2.2 to 3.1[^] His github is GitHub - jobairkhan/MultipleApiVersionsWithSwagger: Asp.Net Core REST API with multiple versions. And swagger is used to...
11 Feb 2020 by MadMyche
While the query may work in your SQL IDE, is that taking into consideration this if...then clause?using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { if (!DBNull.Value.Equals(reader[2])) // how many rows have NULLs in...
15 Mar 2021 by Richard Deeming
Bootstrap modals don't magically appear on their own. They are shown when you trigger them, either by clicking an element in the current page, or via Javascript. Modal · Bootstrap v4.6[^] You need to add some script to your page to display the...
14 Nov 2021 by Richard Deeming
How about: ... @RenderBody() ...
5 Jun 2023 by Richard Deeming
Quote: ... when branch code exist then return true and if not exist return false ... string branches = _db.Branch.Single(x => x.iBranchCode == BranchCode).iBranchCode.ToString(); If the branch doesn't exist, the Single method will throw an...
12 Oct 2023 by Richard Deeming
If you want to parse Razor tags in a string, you'll either need to use the full Razor engine, or use a library like RazorLight[^] or RazorEngine[^] to parse the string. Alternatively, if you just want to load your views from a database, you...
15 Apr 2024 by OriginalGriff
To add to what Dave has said, the session is a Server side construct, not Client - so it's expiration is unrelated to user input unless that input directly causes the Client browser to send (or request) information from the server. Just moving...
29 Oct 2014 by AshishvermaMCA
Any characteristics to identify a view is partial view or not?I know that partial view is preceded with _ sign that shows for reusable.Any other characteristics???Thanks in advanced Ashish kumar verma
29 Oct 2014 by Nathan Minier
There is no difference in the markup between a partial view and a view; the only difference is in how they are delivered to the browser. A partial view is sent via AJAX and must be consumed by JavaScript on the client side, while a View is a full postback. That's it. Normally this means that...
11 Nov 2014 by Member 8070609
(MVC 5) Why do I use when running the back RazorPDF.PdfResult results are RazorPDF.PdfResult which is not the result of a pdf filepublic ActionResult Fprint(int id = 0) { Person p = new Person(); p.name = "aaa"; var pdfresult = new...
11 Nov 2014 by Jameel VM
The problem is if your view is expecting the model of type person(@model Example.Models.Person) you should return the same model from the action result to the view like belowpublic ActionResult Fprint(int id = 0) { Person p = new Person(); p.name = "aaa"; ...
18 Nov 2014 by DamithSL
check this article: Prototype MVC4 Razor ReportViewer? RDLC[^]
19 Nov 2014 by Suraj Sahoo | Coding Passion
Using SSRS in MVC application[^]Incorporate SSRS into ASP.NET MVC[^]Check the links above.Hope these help you.Thanks
7 May 2015 by Sergey Alexandrovich Kryukov
Sorry, the question makes little to no sense. The solution depends on particular blog design.—SA
17 May 2015 by Real_Criffer
why don't you query it out in and store it in the list of your table class like List admins_CBOx = new List();and bind it to combobox like Combobox1.DataSource = admins; and use selectedvalue event from combobox eventand use there methodlikeCombobox1.selectedValue = some of...
22 May 2015 by OriginalGriff
Never, ever, accept code from a insecure website to handle anything to do with real money.You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third...
13 Jul 2015 by F-ES Sitecore
Use the debugging tools in the browser to narrow the issue down. Does the correct html get written out in the form tag? Does your function every get called? Are there errors in the console? What happens when you step through the code line by line? One potential issue is that if your js is...
14 Jul 2015 by Mathivanan KP
I'm using a context menu for MVC projects. I'm using value of the project to enable the add-in. For MVC3,MVC4 and MVC5 its working fine. But MVC 6 (ASP.NET 5) project doesnt have value in the project file (.xproj) and also I cant get the value using the method GetAggregateProjectTypeGuids()...
14 Jul 2015 by Hector Menchaca
Hello,Have you checked this?http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6[^]Maybe this can help you with your issue.Best Regards!
27 Jan 2016 by Member 11670657
Hi I want to display a RDLC report in my view (.cshtml). I have Data model with data. So i want to display them on report.//-------------------------------Controller action------------------------------------public ActionResult ViewRemmitReportList(int period, string fromDate,...
1 Feb 2016 by Member 10469753
I was creating First MVC 6 Web Application , but on create only I am getting error at References ( Error - see Error List ) as shown in Image . I have tried several times also refered many Blogs where giving ASP.NET 5 tutorial ( Stackoverflow,...
2 Feb 2016 by ALIREZA_AKHLAGHI
I Have An Web App (MVC) And Finger Scanner Divice And I Want Use This Device In My Web App.How Can Do This Please Help me
2 Feb 2016 by F-ES Sitecore
You need to use a scanner that comes with software\browser-plug ins that allow it to run from a website. Your server code can't access hardware on the client.
7 Feb 2016 by Manas_Kumar
Try with below options:1. Check if you are referencing of assembly(AppTest.dll) properly and it must be correct version. For example let's say you have an assembly called AppTest.dll which needs an old version of AppTest assembly, but it is added different one. Then it throws error "could...
11 Feb 2016 by Member 11573837
hi,i'm working with asp5 mvc6. But we could not take reference of System.Data in DNX core 5.0 .can you plz hepl meWhat I have tried:i have instale Glimpse.Ado and it doesn't work and i have uninstall it
11 Feb 2016 by Richard Deeming
The System.Data namespace is not currently supported in .NET Core, although it is on the "considered for porting" list.Porting to .NET Core | .NET Blog[^]:System.Data While the base layer is already part of .NET Core, i.e. the provider model and SQL client, some features are currently not...
11 Feb 2016 by Nathan Minier
I'm not going to go to an external site to look at your code, so I'm posting the generic solution.Just use a normal form upload for your file. Then in your controller:public ActionResult UploadAction(HttpPostedFileBase file){ //Save file.InputStream to your...
28 Feb 2016 by Hrushikesh_phapale
We had one website created in html.It has has many html pages .Now we have move this website to mvc application.but issue is when user search something for our company in google it give result like...www.abc.com/home.htmlbut as we have move this mvc , the home.html page is no...
27 Feb 2016 by Afzaal Ahmad Zeeshan
That is exactly why you should not delete the references that application had to static pages. This page, "home.html" was a static web page in your website which is indexed on Google too. Deleting that page was a bad idea. My recommendation is not to move further, instead have the page back....
27 Feb 2016 by Md Shohel Rana
Hi,I want to load Html Table contents(including data/design css/style) into RDLC Report Viewer. That means html table will be loaded with its contents(data/style/css all) on RDLC Report Viewer like rdlc xml contents. Or Is there any possibilities to convert HTML Table to RDLC Tablix XML...
3 Mar 2016 by Microsoft Canada
Daniel Roth overviews ASP.NET 5 and ASP.NET MVC 6. He explains the guiding principles behind ASP.NET MVC 6, and overviews application development, pointing out some important new features in both ASP.NET MVC and Web API.
3 Mar 2016 by Amit Jadli
Please refer the below link it is as per your requirement...where you can add html in your autocomplete li tag by "_renderItem"...Autocomplete | jQuery UI[^]
4 Mar 2016 by itsathere
I am getting this error on server error details is belowSystem.InvalidOperationException: Could not find default endpoint element that references contract 'SurveyService.ISurveyManagementService' in the ServiceModel client configuration section. This might be because no configuration file...
14 Mar 2016 by Onudipto
I am always facing an interview question, that explain some Frameworks in ASP.NET? Please answer me as soon as possible.What I have tried:I was searching in google for the answer of the Question of ASP.NET.
14 Mar 2016 by Andy Lanng
This question can be misleading. ASP.Net is the markup for .Net code. .Net is a Framework (Framework 2.0, 3.5, etc) but what they mean is a different meaning of Framework.The kind of thing they are looking for would include:WebForms...
1 Sep 2016 by CEBE dev
1.Controller action[HttpPost]public IActionResult addNewUser(string name) //tested with [FromBody]{ return Json(name);}2.angular2 http post--UserComponent.tsthis.userService.AddUser(name).subscribe( res => { this.toggle('list'); } ...
15 Mar 2016 by itsathere
I am using jsgrid and i need tab press or up/down arrow key press event from keyboard (when jsgrid is in editable mode) in jquery.What I have tried: $("input").keydown(function (e) { debugger; if (e.which === 9) alert("Hurray!!!"); ...
15 Mar 2016 by itsathere
document.onkeyup = PresTab; function PresTab(e) { var keycode = (window.event) ? event.keyCode : e.keyCode; if (keycode == 9) alert('tab key pressed'); }
1 Apr 2016 by Sisovin168
As my review to the Microsoft.AspNet.Http.Abstractions the IFormFile is missing the InputStream and ContentLength in ASP.NET MVC 6, it insteads of OpenReadStream, which is not functioned to respnse to the ConvertToBytes, for example:private byte[] ConvertToBytes(IFormFile image) ...
5 Apr 2016 by Member 12368437
I have deigned a MVC-6 Application with two forms ,one is Registration form and after Registration I have another form to Login with the same UserName and Password which was entered during registration.What ever I have mention for error message display while register with same data,so the error...
8 Apr 2016 by S. Kamonere
I am new to Kendo UI and I am lost as to why my grid wont display JSON data. Please helpMy HTML
8 Apr 2016 by S. Kamonere
I finally got this fixed. The structure of my solution is such that it has a WebAPI and a Web app. So in the WebApiConfig.cs file I added the line in bold and it worked.public static void Register(HttpConfiguration config) { // Web API configuration and services ...
13 Apr 2016 by Matt Harber
Hi Guys,I have a asp mvc 6 web application that uses Azure active directory single sign on authentication (works fine). However, I have a Xamarin.Android (c#) mobile app that I am trying to connect to the mvc app(acting as the web service). Any ideas on how to authenticate with the mvc...
14 Apr 2016 by Ermany
Hi I have a complete rookie question.So I am using Dropzone js and before submitting my form I upload some files to database (of course user can delete what update before the submit the form). My question is in every succesfull update to database I also add files to list in my controller to be...
2 May 2016 by Member 12497576
I'm trying to publish a MVC6 EF7 project to Azure using VS2015. The project contains 2 DB Contexts: ApplicationDbContext (containing Identity info) and BaseDbContext (containing my project specific schema). I've used the dnx ef migrations tool to enable data scripting. Package Manager Console...