SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your-Table-Name'
ORDER BY ORDINAL_POSITION

Programming is fun and interesting. As you all know, sometime we programmers stucks in the middle way of coding without getting a solution. Blogs like this will help us to find a path to solve our problems. The contents of this blog are the solutions that I found by myself and from other sources. Sharing such solutions is also interesting. Thank you!
Friday, July 1, 2022
SQL query to get all column names of a table - SQL Qury
Sunday, March 27, 2022
Validate dd/mm/yyyy on input keyup jQuery
Format: dd/mm/yyyy
$(document).on("keyup", ".input-date-only", function () {
var inputVal = $(this).val();
let valid = /^0?$|^(?:0?[1-9]|[12]\d|3[01])(?:\/(?:(?:0$|0?[1-9]|1[012]?)(?:\/\d{0,4})?)?)?$/.test(inputVal), input = inputVal;
if (!valid) {
alert("Please enter a valid date!");
$(this).val(input.substring(0, input.length - 1));
}
});
Use the below regex for checking the other formats
Format: dd-mm-yyyy
^0?$|^(?:0?[1-9]|[12]\d|3[01])(?:-(?:(?:0$|0?[1-9]|1[012]?)(?:-\d{0,4})?)?)?$
Format: mm-dd-yyyy
^0?$|^(?:0?[1-9]|1[012]?)(?:-(?:(?:0$|0?[1-9]|[12]\d|3[01])(?:-\d{0,4})?)?)?$
Format: yyyy-mm-dd
^\d{0,4}$|^\d{4}-0?$|^\d{4}-(?:0?[1-9]|1[012])(?:-(?:0?[1-9]?|[12]\d|3[01])?)?$
Tuesday, March 8, 2022
IdentityServer4 .NET Core Ajax Call not working after page is idle for several minutes #Solved
I have faced this problem while trying to implement IdentityServer4 in Microservice .net core project. I tried several codes and spend many days on this.
Finally, it's working fine. I have changed the Cookie settings in both the client-side and Identity server-side application configs.
Please try this and if anyone finds any better solutions, please let me know. Enjoy :)
Client-Side Config
.AddCookie("Cookies", c =>
{
c.Cookie.SameSite = SameSiteMode.None;
c.Cookie.SecurePolicy = CookieSecurePolicy.Always;
c.Cookie.IsEssential = true;
c.SlidingExpiration = true;
c.ExpireTimeSpan = System.TimeSpan.FromHours(60);
}
In the AddOpenIdConnect set
options.UseTokenLifetime = false;
IdentityServer Config
builder.Services.Configure<CookieAuthenticationOptions>(IdentityServerConstants.DefaultCookieAuthenticationScheme, options =>
{
options.Cookie.SameSite = SameSiteMode.None;
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
options.Cookie.IsEssential = true;
options.SlidingExpiration = true;
options.ExpireTimeSpan = System.TimeSpan.FromHours(60);
});
Usually, for Cookie-related problems, we don't need to adjust anything on the IdentityServer side.
But it is a little bit complex for me, that's why I have added the settings to both configs.
Monday, March 7, 2022
SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
I restarted this service: Host Network Service on
windows Services program. And it worked. Open windows terminal as Admin
and run the following commands one by one.
Step 1
----------------------
net stop hns
Step 2
----------------------
net start hns