@manhnguyenv

Welcome to my blog!

ASP.NET MVC 5

April 11, 2019 22:00

ASP.NET MVC 5 (edit)

https://www.asmak9.com/2017/12/aspnet-mvc5-google-charts-api.html

https://www.asmak9.com/2018/10/aspnet-core-entity-framework-call-store.html

https://www.asmak9.com/2018/05/aspnet-mvc-oauth-20-rest-web-api.html

https://www.asmak9.com/2016/04/aspnet-mvc5-role-base-accessibility.html

Selec2

https://datatables.net/forums/discussion/30618/loading-multiple-tags-into-select2-field-using-ajax

Source code

https://onedrive.live.com/?id=D082EB74D162369B%211323&cid=D082EB74D162369B

ASP.NET MVC Security

https://stackoverflow.com/questions/1064271/asp-net-mvc-set-custom-iidentity-or-iprincipal

https://www.c-sharpcorner.com/article/asp-net-mvc5-rest-web-api-authorization/

https://www.c-sharpcorner.com/UploadFile/2b481f/Asp-Net-web-api-authorization-and-authontication/

https://davidpine.net/blog/principal-architecture-changes/

ASP.NET Forms Authentication

https://web.archive.org/web/20120422011422/http://ondotnet.com/pub/a/dotnet/2004/02/02/effectiveformsauth.html

ASP.NET MVC 5 - How to build a website

December 27, 2018 22:46

ASP.NET MVC 5 - How to build a website (edit)

Product Description

This book is primarily aimed at developers who have some prior experience with MVC 5 and are proficient in C#, since the language won’t be explained in any detail. Even if you already have created a couple of MVC projects, you might find the content in this book useful as a refresher. You might have worked in previous versions of Visual Studio and MVC and want a fast no-fluff way to get up to speed with MVC 5.

Prerequisites:
•C# (you need to be proficient)
•MVC 5 (you need some prior experience)
•HTML5/CSS3 (you need basic knowledge)
•JavaScript/JQuery (you need basic knowledge)

In this book you will learn how to build an MVC 5 website using C#, Entity Framework, HTML5, CSS, JavaScript and Ajax.

•Create a "real world" code-first database using Entity Framework.
•Add and modify models, views and controllers to perform CRUD operations against the database.
•Use client-side and server-side validation.
•Secure the controllers, actions and view content with authorization and roles.
•Implement security with ASP.NET Identity (authentication, authorization and roles).
•Use JavaScript, JQuery and Ajax to build a great end-user interface with asynchronous server calls.
•Style the user interfaces using CSS3 and Bootstrap.
•Create a responsive website.
•Implement product subscription scenarios with registration codes.
•Create an alternate way to login to the application.
•Implement password reset functionality.
•Register users with the site.
•Manage users and their subscriptions.

Technologies, frameworks and languages:
•C# (you need to be proficient)
•HTML5/CSS3 (you need basic knowledge)
•JavaScript/JQuery (you need basic knowledge)
•MVC 5 (you will create/modify models, views and controllers)
•Razor syntax (to include server-side code in views)
•Bootstrap (used for styling and to create a responsive design)
•Ajax (used for asynchronous server calls)
•LINQ (to query the database)
•Extension methods (to clean up your C# code and enable re-use)
•HTML Helper methods (to clean up your HTML and enable re-use)
•Use settings from the web.config file

ASP.NET MVC 5

ASP.NET MVC is another option available to ASP.NET developers for creating web applications on the .NET platform.

ASP.NET MVC is an implementation of the MVC pattern. MVC is an architectural pattern which provides guidelines on how to structure the application.It is specially suited to the web applications of today as it provides a loosely coupled approach to structure the application.According to MVC pattern the application is separated into three different components.

Model  The Model contains the business entities our application deals with as well as the business logic or business rules for our application.This is usually a class which talks to the database to fetch and update data.

View The view is just a template which is used to generate the user interface such as HTML.

Controller  The controller is responsible for accepting user input, performing operations on the model and selecting the view to render.

We can depict the relationship between the Model ,View and Controller with the below diagram.As we can see the controller is the Main component as it coordinates with both the View and the Model.Also note that the View is aware of the Model while Model is not aware of View.The advantage that this provides is that our application is loosely coupled.

mvc architecture

MVC pattern separates the application in three main components

The main advantages of using  ASP.NET MVC are

Separation of Concerns As the Model,View and Controller are separate we can update or replace any of the components without effecting the rest of the application.This results in better maintenance of the code.

Testability  As the controller are independent classes in MVC ,and not tightly coupled to the UI as WebForms , we can very easily unit test the application logic that the controller classes contains.

LightWeight  As there is no view state in MVC so the generated HTML is significantly smaller in size as compared to WerbForms.

Control over HTML and CSS   In WebForms there is HTML which is generated by the server controls over which we have little or no control.MVC doesn’t have server controls like webforms ,instead we provide the HTML that we want to return to the user.As we write the HTML so we can write HTML that is required.

MVC framework is defined in the System.Web.Mvc assembly.So we need to include this assembly in our MVC applications.

There has been many releases of MVC. The last official release was MVC 5. The preview of MVC 6 is also available now.

MVC 5 which was released as a part of visual studio 2013 has many new features.Some of these features are

ASP.NET Identity  The previous membership system has been replaced with ASP.NET identity which provides some nice features such as a authentication using login providers such as twitter.

Supports Bootstrap framework  Bootstrap is the most famous HTML, CSS, and Javascript framework for creating responsive and mobile first web sites.It is a totally free framework.

Attribute based routing  We can attach the attributes directly to the controller classes and action methods.In the previous versions we can add the routes only in a separate RouteConfig.cs file.

Scaffolding  This is a process which generates code based on our model classes.This is an automatic process so we don’t need to write the boilerplate code by hand as the basic structure is generated for us.

So this was just an introduction to ASP.NET MVC framework.The next article Controller in MVCdescribes controller ,which is one of the most important parts of mvc application, in more detail.

DotNet Tranining

https://www.credosystemz.com/training-in-chennai/best-dotnet-training-in-chennai/

Why Use ASP .Net For Building Your Website

Not Just for Business Applications: Why You Should Choose ASP.NET for Your Next Website

ASP.NET is a platform that is backed by the power of Microsoft that can use any .NET-supported language, and was created to provide developers with an easy scripting tool to create web apps and pages. It is a successor to ASP (Active Server Pages), which was pioneered by Microsoft in the mid-90s. The early domination of the web browser marketby Internet Explorer helped increase the popularity of ASP.NET. Unlikely PHP, which is a true programming language, ASP.NET is a web framework – actual programming on ASP.NET is generally done in C#, or much more rarely in VB.NET. While ASP.NET is often utilized for building websites, it also has a life outside web programming with a great deal of business applications, gaming and mobile programming; unlike “competitor” PHP, which is used almost exclusively for web.

Extensibility

One of the key benefits of utilizing ASP.NET to build your website is that if your organization is a .NET shop overall, then it will be much easier to tie into your existing business applications that are already built within this platform paradigm. There is also an immense network of support for ASP.NET – from bloggers to fellow developers to gurus who are willing to answer questions for free and help with code snippets. This definitely isn’t a platform that will leave you feeling like you’re alone on a deserted island – the community is alive, efficient, and highly-structured.

Scalability

Consider that one of the most-used websites ever was built on an ASP.NET platform: MySpace. While MySpace was edged out by PHP-built Facebook, it is still a massive site for artists and musicians and had to manage unbelievable amounts of content and go through multiple upgrades throughout its life.

Development Costs

While you may hear the name “Microsoft” and think “expensive”, this isn’t necessarily the case. Microsoft is known for never giving anything away for free but for whatever reason they have made an exception with ASP.NET – you can get everything you need to develop ASP.NET applications without spending a dime. If you’re a beginner with ASP.NET, Microsoft offers WebMatrix, a dev environment that is created just for beginners with a built-in web server (IIS Express) as well as a database engine (SQL Compact Edition), plus deployment tools to get your site to a remote host. Students should check out the DreamSpark program to receive free copies of Visual Studio Pro, Windows Server Oss, and Expression Studio.

The Express editions of Visual Studio are free for more advanced users, although the functionality is trimmed down from the full Visual Studio – it has a built-in web server but no database engine. However, Microsoft has that covered, too, with their SQL Server Express that can be used for dev and even some deployment situations. Anything you develop with the Visual Web Developer Express (VWD) can be opened in the full version, should you decide to purchase it.

Assumptions

There are some assumptions that you may have heard about ASP.NET website development: that it’s only for large enterprise-class websites, that it’s a closed environment, that it’s Windows only, that it’s static instead of dynamic (not necessarily a bad thing!), and that it’s a horrid choice for small, personal websites. While Microsoft as an organization definitely has an enterprise mentality, ASP.NET is surprisingly suitable even for smaller projects. It’s extensively utilized for Windows Phone, Azure, and other business environments, but the pure simplicity of the platform leads it to be an excellent choice for smaller projects that don’t need to be complex or over-engineered, especially with the WebMatrix development option for beginners.

While some may feel that ASP.NET is overkill for very small business websites, the platform is quite flexible, has excellent scalability and community support, and easily ties in with .NET business applications – which can add long-term value to your website in a way that other platforms may not support.

Sources:

http://www.codeproject.com/Tips/816904/Why-Use-ASP-NET-for-Web-Development
http://www.asp.net/aspnet/overview/making-websites-with-aspnet/making-websites-with-aspnet
http://www.asp.net/get-started/websites
http://www.sitepoint.com/asp-dot-net-basics/
http://www.jankoatwarpspeed.com/discussion-why-web-designers-often-use-php-over-asp-net/
https://www.linkedin.com/pulse/20141114182637-12880086-php-vs-asp-net-what-you-should-really-be-comparing-instead
https://blog.udemy.com/php-vs-asp-net/

What is the future of ASP.NET? What will benefit an ASP.NET?

ASP .NET Core is a cross-platform, high-performance, open-source framework for building modern, cloud-based, Internet-connected applications. With ASP .NET Core, you can:
  • Build web apps and services, IoT apps, and mobile back ends.
  • Use your favorite development tools on Windows, macOS, and Linux.
  • Deploy to the cloud or on-premises.
  • Run on .NET Core or .NET Framework

Here is the Scope of ASP. Net Developers in various Domain

  • E- Commerce.
  • Construction Industry Information Technology Services/IT Consulting.
  • IT/Web Services.
  • Travel & Tourism.
  • Finance.
  • Social Networking
  • Social Plug-in Widgets
  • Construction Industry.
  • Print Media
  • Blog Widgets
  • Insurance
  • C# and .Net framework
  • HTML & CSS
  • MVC
  • WCF, WPF
  • Entity Framework
  • Web-Api
  • JavaScript (MVW framework, J-Query )
  • Bootstrap and XML
  • Ms Sql (Microsoft SQL server)
  • Understanding of client-side technologies
  • Database application
  • Microsoft certified solutions developer (MCSD)
  • Microsoft MVP (Most Valued Professional)

Bootstrap Datetimepicker

March 16, 2018 00:28

Bootstrap Datetimepicker 4 (edit)

https://stackoverflow.com/questions/40035730/bootstrap-date-time-picker

https://stackoverflow.com/questions/23137720/disable-time-in-bootstrap-date-time-picker

https://stackoverflow.com/questions/40035730/bootstrap-date-time-picker

https://stackoverflow.com/questions/23137720/disable-time-in-bootstrap-date-time-picker

https://stackoverflow.com/questions/35778600/bootstrap-datepicker-locale-with-momentjs

https://stackoverflow.com/questions/33918017/bootstrap-datepicker-how-to-use-specific-time-zone

Bootstrap Datetimepicker 3

http://www.skimedic.com/blog/post/2015/04/03/Using-a-DateTime-Picker-for-ASPNET-MVC-5-with-Bootstrap.aspx

http://eonasdan.github.io/bootstrap-datetimepicker/#options

https://stackoverflow.com/questions/40035730/bootstrap-date-time-picker

https://stackoverflow.com/questions/24410685/bootstrap-3-datetimepicker-3-0-0-week-starts-at-monday

https://stackoverflow.com/questions/19382189/change-language-for-bootstrap-datetimepicker

https://stackoverflow.com/questions/22846525/bootstrap-datetimepicker-not-working

Instead of using moment.js I used moment-with-langs.js (I guess it came with default package ASP.NET MVC 5).

By calling:

<script type="text/javascript">
    $('#DateTime').datetimepicker({
        language: "hr"
    });
</script>

thing works, finally the calender starts from monday.

UPDATE: Even better, add key to web.config

<appSettings>    
    <add key="Culture" value="hr" />
</appSettings>

and then

$(document).ready(function () {
    $(document).on('focus', '#Date', function () {
        $(this).datetimepicker({
            locale: '@System.Configuration.ConfigurationManager.AppSettings["Culture"]',
            format: 'DD:MM:YYYY',
        });
    });
});

Categories

Recent posts