MVC routing just got cleverer

Microsoft has been launching quite a few latest software as well as programs, among which MVC is one. MVC has a lot of unique and special features; among them the routing function is been touted as the best improvement, especially since it has become attribute based. Initially the function of MVC routing was for cleaning of URL semantics of sites that have been built on it. However, now the function as well as importance have changed dramatically, making the entire concept cleverer and more useful.

.net web development, .net application development services, hire .net developersMany of us have doubts regarding the need of routing. Features like Controllers, Models and Views are deemed as important parts of the application since any application needs user interaction which is handled by controllers. Controller also selects appropriate views to be rendered. The UI or View is used by users when interacting with applications; while the data required for an application is represented by Model. But when we come to routing, we do not see it addressing any concerns like those mentioned.

Traditionally in web applications, a user enters URL in browser maps for location of particular physical file that is mapped to web server’s directory which is often called virtual directory. For example when we are using an URL, it refers to products or businesses in question. When you look at the URL you will be able to judge the line of business or category; it is easily discernible as it lists products or services of that category. After displaying that fact subcategories must be added which will display only things related to that topic. For the same, a filter has to be applied on the page so that the user clicking on the hyperlink, gets a unique Id representing that object. This solves the problem of directing him or her to particular categories. Now the user will be able to pinpoint and look at those things that he or she is interested in.

To lend a unique ID if we use numbers there are chances that the user will simply forget the numbers but adding words will be better than numbers as it will be easier to remember. Adding words to URL names them as hackable URL and it is here that routing gives benefits. Routing is very important here as there are no physical files in MVC for better handling of different requests, contrary traditional applications and this routing mechanism helps MVC decide which controller class’s action method to be used for execution. There can be no mapping of action method to requests without routing. This MVC architecture’s part- routing is supported by default.

Routing enables us to create URLs which are search engine optimized and that too very easily. This is because when using this there are no restrictions regarding fixed URLs which can be easily re-factored so that search engines can discover them easily. Custom routes can be created as well.

Attribute-based routing gives you finer control on the routes of both action and controller levels. Enabling this is a simple task; just take your RegisterRoutes function and add call route .MapMvcAttributes(). You can also add attributes at controller level and this will apply to every action within controller unless you have added some particular route to some action.

You also have the option of doing routing on actions based on constraints. This is quite akin to function overrides as matching of a route will occur if there is matching of data type; if not the request will be transferred to another route which matches the pattern for some supported data type. Multiple constraints can be applied to single route so that precise control can be gained over URLs, routes and actions. You can also use for convention and attribute based ones simultaneously.

You will be able to free URLs from being physically associated with files by implementing this, allowing for plenty of flexibility regarding the interpretation and presentation of URLs in MVC applications. This would help you leverage the benefits of .net web development.

We provide .net application development services. If you would like to hire .net developers from us, we would be glad to assist you at Mindfire Solutions.

How to Run Windows Azure Technology within Your Own Datacenter

Windows Azure is a brand new application platform introduced by Microsoft for the public cloud. The discussion regarding the running of this brand new technology within the individual data center would be of precisely no value without an understanding of the technology in the very first place. Now, the platform can actually be used for a number of purposes such as building of the web applications that are capable of running as well as storing the data in the respective datacenters. Simple storing of the data also becomes easier with this enterprise-friendly technology. Developers prefer exploring the technology to build highly scalable applications that involve too many users. In fact, the platform is turning out to be of increasing importance primarily by virtue of its wide range of services.

Data Management with the Windows Azure Technology

asp.net application development, .net development services, certified .net developersConsidering the fact that the varying types of applications need equally varying sorts of data, the platform comes up with different ways of storing as well as managing data. The three data management options that the technology offers are SQL database, blobs and tables. To begin with, the SQL database offers all the necessary features of a relational data management system. For users who are looking forward to creating a Windows Azure application, which is, in need of relational storage, the SQL database is indeed a good option.

Tables, on the other hand, are the best options if you are willing to get faster access to a variety of typed data. For instance, if you are creating a consumer application that must be able to store the customer profile information related to every particular user, the Windows Azure Tables will be of special significance. Blobs help in data management in a very unique and effective manner. These are designed for the storage of the unstructured binary data. Further, blobs, very much like Tables, offer reasonable storage facilities. Contents, which are perceived as ordinary Window files by the application, are actually stored in this blob.

Running Azure within Individual DataCenter

The concerned Pack for the server offers a solution for the businesses that are willing to operate as service- providers with the aim of attracting enterprise workloads. The pack runs on the top of the System Center and the Windows Server and delivers the technologies into the datacenter. This paves the way for the richer, multi-tenant cloud accompanied by commendable experiences. Now, the pack is basically a collection of this new technologies. It enables the Microsoft customers to install the pack in enterprise as well as service provider datacenters without incurring any extra cost for the purpose. The datacenters, additionally, are integrated with the server environments of the operating system and the existing system center. The Microsoft cloud OS comes up with the intention of providing customers with a single consistent platform for data, applications and infrastructure.

Thus, using the familiar foundation of the respective server and the system center paves the road to delivering not just enterprise class but also reasonable solutions for the multi-tenant cloud infrastructure services. Both enterprise customers as well as the service- providers are ready to build customizable solutions by means of a desired use of the industry standard hardware, open technologies along with a broad application platform.

Recent attempts are being made to relate SharePoint and Windows Azure technology. It is even considered that the Azure Pack had actually been missing from the apps puzzle of the latest version of SharePoint. However, there is no doubt that the introduction of the Azure technology coupled with the many features that it brings with it has been of immense benefits for the enterprises all over. This would help you leverage the benefits of asp.net application development.

We provide .net development services. If you would like to talk to one of our certified .net developers, please get in touch with us at Mindfire Solutions.

How to Implement Two Factor Authentication in MVC with Google Authenticator

These days, more and more websites are providing the option of two factor authentication for your login process. This process allows the authentication of users with the use of two of three authentication factors which are deemed valid. The three valid factors are- something known by the user like PIN, passwords, etc.; something used by the user like ATM card, phone, smart card, RSA keys, etc.; and something like biometric data which includes fingerprints. This two factor authentication has been embraced by quite a few organizations including Dropbox, Hotmail, GitHub and Google, providing this as a security measure that is optional.

asp.net development, .net application development, asp.net developerIn two factor authentication you have to use a combination of at least two factors. Factors like mobiles or RSA keys are best and most common sources used for the generation of one time passwords which is changed over time. For example the code of RSA keys is changed every minute while it is changed by Google Authenticator every 30 seconds. This helps in mitigating chances of attackers intercepting the web traffic. The software based Google Authenticator is an authentication token based on two factors as is apparent from the name itself. This is available on Blackberry, iOS and Android operating systems. A 6 digit counter or time based number is provided by it which acts as 2nd factor for the authentication.

Now Google Authenticator works by implementing algorithms defined in RFC 6238 which is time-based implementation of the authentication process and RFC 4226 which is counter-based one. The user and the server have to agree on some secret key that will be used as seed value for hashing function. This key can be typed by the user in Google Authenticator or QR code can be used for the automatic setting up of the application. Then any of the algorithms are used by Authenticator and a code is generated for the entering during the process. The very same algorithm as well as secret key is then used by the server for the checking of the code. After agreeing on the secret key, the application generates a 6 digit key which will be the sole data which will be passing between the server and client, without the data passing through servers of Google.

Generation of one-time passwords requires three types of information- counter number, the output’s number of digits which are limited to 6 as well as the secret key. For the generation iteration number has to be converted to byte[]. With every authentication success iteration number will be incremented on server and client. Hashing method can be used for that and this hash has to be computed for the counter’s current value. The code’s next part leads to extraction of binary value of an integer of 4 bytes and then it is shrunk to the required number of digits. One-time password generated based on time can be done following the same principles as the above, except for the automatic definition of time intervals based on counter. A time interval of 30 seconds as well as Unix epoch is required by Authenticator.

After knowing about the working of the code you have to know about how to use it.

1. Creating MVC Web Application- Open Visual Studio 2010 to use “New Project” wizard for creation of new MVC Web Application. Select Internet application there which will result in creation of default Account controller.

2. Creating TwoFactorProfile Class- A Profile class inherited from ProfileBase can be created to store 2 factor secret.

3. Modifying web.config- The element inherited from the TwoFactorProfile created by us can be modified.

4. Modifying AccountController- AccountController has to be modified in some places like Register action so that the user can be sent to ShowTwoFactorSecret page for the setting up of Google Authenticator. ShowTwoFactorSecret action can be created and the LogOn action changed for checking of code that has been provided by user for the validity assurance.

5. Modifying AccountModels- A field can be added to LogOnMode1 class for the working of ShowTwoFactorSecret and new LogOn actions. Then new TwoFactorSecret class can be created.

6. Modifying LogOn.cshtml View- The LogOn view can then be modified for the addition of new TwoFactorCode field.

7. Creating ShowTwoFactorSecret view- Finally the ShowTwoFactorSecret view has to be created by using a QR code’s image for the user to scan; the secret can be manually entered as a string.

After you register in the application as new user, a QR code must be scanned with the app or the code under the QR code must be entered manually. After logging in there will be a new field for the entering of Google Authenticator Code. At this point the code must be entered; after entering the code, enter username and password correctly and there will be no problems in logging in. This would help you leverage the benefits of asp.net development.

We provide .net application development services. If you would like to discuss with a certified .net web developer from our team, please get in touch with us at Mindfire Solutions.

The Good, the Bad and the Ugly of ASP.NET Identity

ASP.NET, developed by Microsoft, stands for Active Server Pages .NET and is used for the purpose of creating web pages as well as web technologies. The .NET framework has turned out to be an essential tool for programmers, willing to create dynamic websites by means of compiling languages like C# and VB.

asp.net web development, .net application development services, .Net web developerNow, this framework is not restricted to the scripting languages alone but extends beyond that to enable the use of the .NET languages. With the many benefits of this framework in mind, it would also be desirable to look into the not so useful sides of the same. So, here is an overview of the good, bad and somewhat ugly sides of this identity management framework.

The Good Side

1. Facilitates Customization of Storage: Customization of storage was a distant possibility with the earlier identity management frameworks mainly because these were either too cramped or too subtle. With the present one, however, a successful separation of the storage of the identity information from that of the code that is responsible for an implementation of the security has been achieved. As such, one can, now, implement the interfaces and determine the way the data is actually stored.

Developers have the option of customizing the user account data and in the event that they want more data associated with the user, these can be added on the customized user class that deploys the interface. Consequently, the extra data can be stored by means of an implementation of the IuserStore.

2. Speedy: ASP.NET stands out from any other identity management frameworks by virtue of its ability to create websites rather quickly. The programming language comes with a number of features that pave the way for a faster development of websites and considering the present scenario, this is quite an advantage.

3. Asynchronous Support: A clear majority of the APIs in the new identity management framework are asynchronous and this certainly comes across as a major advantage. The addition is going to make the framework all the more useful for the web developers in the coming days.

The Bad Side

1. Too Close Following of the Windows: This is one big complaint of most developers against the ASP.NET framework. The framework is often said to follow the Windows form a bit too closely, which leads to awkwardness in building the web-based applications.

2. The Presence of the IuserRoleStore: The interface associating roles with the users known as IuserRoleStore often makes things unnecessarily complicated. The interface, though optional, has to be implemented on the user store if an explicit role support is what you are actually looking for. Moreover, much confusion arises on the issue regarding where the role can be kept. The developers must be aware of whether to keep them in the role store or the claims store for successful operation.

The Ugly Side

1. Presence of Leaky Abstractions: While this framework can be considered a combination of mostly good and few bad features, there is actually an ugly side to it and that is, a presence of the leaky abstractions. In the earlier versions, not all the APIs have to be included, which is why, the application must know as to which API it can implement and which it cannot. The present one is certainly much better designed though the possibilities of leaky abstractions remain.

2. Absence of the Desired Security Stuffs: It is the presence of those effective security stuffs that justifies the usage of a security framework. However, ASP.NET fails in this respect because of an absence of certain features, which include email account verification, password reset, username reminder, mobile phone verification, modern password storage and so on.

The above-mentioned ones are but few of the good, bad as well as ugly sides of asp.net web development.

We provide .net application development services. If you would like to discuss with a certified .net web developer from our team, please get in touch with us at Mindfire Solutions.

3 Common Debugging Errors in Visual Studio 2013

Visual Studio is a broad collection of tools as well as services to help you build a comprehensive range of different apps, for especially the Microsoft platform and beyond. Visual Studio is meant to connect all of your teams, projects or stakeholders. Now with the help of Visual Studio 2013, it has become easier for your design team to work from virtually anywhere with greater agility, regardless of development tool Xcode or Eclipse.

Correcting the logic error is essential

.net web development, .net application development services, asp.net developerOnce you are done with .net web development and your application is created, build errors are resolved, you need to debug the logic errors that prevent your stored procedures or application from running accurately. This can be done with integrated debugging functions of the development environment. These help you register values and inspect memory, stop at procedure locations, observe message traffic, change variables and get a clear view of what your code does.

What is debugging?

It is really a decisive point for any kind of development project and especially during the time of execution of an application. Numerous errors are found to occur at the time of running application. Visual Studio involves a set of debugging as well as testing tools to help you ensure the highest quality of your Windows Store app.

Here are 3 common errors that all designers face while debugging .Net apps.

1. Asynchronous Debugging for Windows Store Apps: The debugger has improved support for the Windows Runtime for asynchronous programming model. In the framework languages of .NET, the model is expressed directly through the Async/Await (async/await keyword) in Visual Basic. In C++/Cx and C++ and .then continuations, task objects support the model. JavaScript uses .then continuations as well as promise objects.

The Call Stack window introduces the methods which call asynchronous performs under information frames of Async Call. The Tasks window, which was earlier regarded as the Parallel Tasks window helps in displaying the new model as tasks, in addition to advanced information regarding the tasks.

For C++ Windows Store App, enhanced exception reporting plays a major role. The debugger now supports to capture stack traces for enhanced C++ exceptions, at the time these occur in Windows Runtime parts. The debugger are able to display those stack traces that are captured whenever these are accessible on exception components that are derived from Exception (Platform). When the exception occurs, at a first-chance exception, the debugger displays the exception dialog box for listing the stack trace at that point.

You can also inspect exceptions in future Windows Runtime for a debugging session if you add the $exceptiontrace psuedovariable to the Watch window. If any exception occurs in the current thread, the entry can be expanded in the Watch window for seeing the stack track trace or navigating to source code which caused the exception. You can even watch $exceptiontrace by selecting the Add exception stack trace for watching link in the exception dialog box.

2. Just My Code for JavaScript and C++ Debugging: In the Call Stack window, Just My Code hides non-user code, like the code in system, Win.JS or 3rd party libraries. This option helps developers by making it much simpler to find your procedure at the time of debugging in mixed mode with C++and JavaScript or debugging asynchronous code.

By default, Just My Code remains on in Visual Studio 2013. On the call stack, you can view all code by choosing Settings as well as Options on the Debug menu to clear the checkbox in Enable Just My Code. This setting applies for all programming languages which support such option.

3. 64-bit Edit or Continue in the .NET Framework: Now, the debugger supports continue as well as edit for applications that target 64-bit platforms. Another major issue that often affects .NET apps running in the production environments includes problems related to their memory use and it can potentially have effect on both the application as well as the entire machine. Visual Studio 2013 helps by expanding the dump file analysis tools for finding inefficient memory use, memory leaks and spare allocations in the .NET Framework database, desktop applications and web.

The Visual Studio debugger assists in controlling the execution of any program and examining its state. The debugger can be used to analyze the defects in a Windows Store app and thereby making you understand exactly how your app functions. Whether you are creating mission-critical .NET apps, designing blazing-fast code with C++ AMP,  or debugging and testing any cloud-connected mobile app (based on HTML/JavaScript) which runs on many devices, join millions of designers worldwide in preferring Visual Studio as your primary development environment.

We provide .net application development services. If you would like to discuss with a certified asp.net developer from our team, please get in touch with us at Mindfire Solutions.