Skip to main content

Posts

Currently I'm working on a ASP.NET CORE 2.2 based project.
So, I wanted to host in IIS, which is on Windows Server 2012 R2 system. So, I followed following steps: Installed latest version of .NET Core Runtime & Hosting Bundle for Windows. Which you can find in this.Created the application pool with .NET CLR Version: No Manged CodeThen created the web application pointing to that application pool.
But it was not working, and it started giving me 503 Service Unavailable error. Most important thing is, it was not only for this the web application that I created, it was for all the application hosted in this server. When I investigated more I found the following error in Event Viewer:




After looking around for some time, I came to know that the ASP.NET Core/.NET Core: Runtime & Hosting Bundle (latest versions) depends on Microsoft Visual C++ 2015 Redistributable. Even while installing the ASP.NET Core: Runtime & Hosting Bundle installer doesn't tell you about this missi…
Recent posts

Common Design Principles

There are number of common design principles that, like design patterns, best practice over the years to build maintainable software.
I'm up to describe some widely used design principles though out the post.

Following common principle are extracted by the same book that I mentioned before (Professional ASP.Net Design Patterns - Scott Millet).
Principles are as follows:
Keep It Simple Stupid (KISS) One common issue in software programming is over-complicating a solution. So main concern of this principle is keep the code simple but not simplistic. Eventually this will avoid unnecessary complexities.
Don't Repeat yourself (DRY) Main concern of this principle is to avoid the repetition. In other words this is all about abstracting out the common functionalities into a single place. Ex: If there is a price calculation method in a system. It should lay in a single place there.
Tell Don't Ask The Tell, Don’t Ask principle is closely aligned with encapsulation and the assigning of resp…

S.O.L.I.D Design Principles

Hold on!!! Before this please read the common design principle post.
After a long time thought of writing a post. Actually these days I'm reading a book which is written by Scott Millet and the name of the book is "Professional ASP.Net Design Patterns". I can guarantee that this book give you a great knowledge on design stuffs.

Most of us are bit lazy to read things, so I thought of posting the things that I got form it. This is like the cream of what I got.

I'll start it with the S.O.L.I.D design principles:

The term S.O.L.I.D. comes from the initial letter of each of the five principles that were collected in the book Agile Principles, Patterns, and Practices in C# by Robert C. Martin, or Uncle Bob to his friends. Simply this is a collection of best practices for object-oriented design.

Following will explain all the principles:

Single Responsibility Principle(SRP)
This principle is closely aligned with a common design principle called Separation of Concerns. It says that…

LINQ : Query expression vs Lambda Expression

All the time I was using LINQ on projects I was wondering whether there is a performance difference between query expression and lambda expression.So I decided to dig into it. I wanted to examine MSIL for both of these situations. I wrote small class which has two methods. One is using query expression and the other one is using lambda.I complied this code and got the dll and view the MSIL using ildasm.exe. This following picture will show you the MSIL of GetFirst() method.And this following picture will show you the MSIL of the GetSecond() method.Yes!!! you can see that there is no different between these 2 MSIL. Will there be a performance difference???

Exit a T-SQL Cursor When Condition is met

Have you ever wanted to exit from a cursor when a condition is met? I wanted to do it. So this is how I did it.

DECLARE @Field1 AS INT
DECLARE @Field2 AS INT

DECLARE CursorName CURSOR READ_ONLY
FOR

SELECT
Field1,
Field2
FROM TableName

OPEN CursorName

FETCH NEXT FROM CursorName
INTO @Field1, @Field2

WHILE @@FETCH_STATUS = 0
BEGIN

IF @Field1 = 1
BEGIN
GOTO ENDCURSOR
END

FETCH NEXT FROM CursorName
INTO @Field1, @Field2

END

ENDCURSOR:
CLOSE CursorName
DEALLOCATE CursorName

I have set my fonts to bold where you want to notice.

So that's all I hope you will get something out of it and it is true that this is not a big deal. :)

Populate Modal popup data which is bind to a link button - ASP.net

I wanted to do a POC to my client to show modal popup functionality. So I did a simple page with one Button and a TextBox. That Button is responsible to popup the modal window. On that ModalPopup I implemented a search mechanism. I used Girdview control to show the search result.

I wanted to populate the id value of that search result which was binded to a link button. This gridview and the text box and button was in a AJAX update panel control. I did this because I wanted to have the smothness of the UI.

Now I met a new problem. Because I wanted to get that value out of that LinkButton control and show it in a TextBox control which was out of the ModalPopup.

So what I did was, I just assign that LinkButton's text property to a HiddenField and I used a JavaScript function to populate that HiddenField value the TextBox.

As you all know we need a Panel control to show our ModalPopup. This is gonna be a <div> on the HTML. So I used the onblur event to call my JavaScript function.