Sid’s Blog

(life => life.make_it_better)

How to get version or product details from a .dll file or running application?

| Comments

I came across a scenario where I had to access some information from a file with .dll extension. And then I thought to write this post. This information may include that assembly’s product name, product version, file version etc. This scenario may be required either to read a .dll file from disk or from the current running application. The code below covers both the scenarios:

1
2
3
4
5
6
7
8
9
10
11
// From executing application.
string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

// From a physical file, provide full path to that file.
string assemblyVersion = Assembly.LoadFile('your assembly file').GetName().Version.ToString();

// From executing application, gives file version.
string fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

// From executing application, gives product version.
string productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;

HTML5 LocalStorage API to the rescue

| Comments

Recently I had a need to use HTML5 LocalStorage API in my web application project. The requirement was to save the vertical scroll position of window when a user drills down to low level details by navigating to other view. I didn’t wanted to cookies because cookies are sent on every request to the server and I have no need to send this detail to the server as it is just related to client.

Then I was left with LocalStorage and SessionStorage as options. I found that SessionStorage is not maintained when the page reloads and when the browser is closed.

How to get UnAuthorizedAccess (401) HTTP response when using ASP.NET Forms Authentication and AJAX?

| Comments

I’ve a ASP.NET MVC application that uses FormsAuthentication and this application gives single page application experience to users after a user is authenticated where it uses AJAX for all HTTP requests.

The log out action that I have works fine if user uses the logout button in the user interface and the click handler than performs a HTTP POST to Logout action in Account controller.

Today,I was testing some other feature by setting 1 minute timeout for forms authentication in web.config. After a minute, when I performs a POST action to view a different view in my application, I was shown the user login page as set in the web.config under forms configuration. But I was not able to understand why is this happening. Later I figured out that the FormsAuthentication is doing its work and it detects that this user is not authorized. It then redirects the user to the login url as defined in the configuration.

Cookie issues with Internet Explorer.

| Comments

Recently, I was working on a ASP.NET MVC 5 web application that was using cookies to store some user specific data. This was done by first serializing that object into forms authentication ticket and then encrypting this serialized data and setting this encrypted value to a cookie.

Unit Test and Test Driven Development in ASP.NET MVC application

| Comments

This article aims to summarize the concept of testing which can help you while writing tests using any framework out there. I will be writing more on this topic and will also attach any relevant demo applications on github. 

Types of Testing

There are many types of testing that you may want to apply to your application, namely:

  • Unit Test & Test Driven Development (TDD)
  • User Interface Testing
  • Integration Testing
  • Acceptance Testing 
  • Performance Testing
  • Accessibility Testing
  • Security Testing

Some facts about all the Programmer or a Software Developer

| Comments

No matter where you are in your software development career or what technologies you work with, there are couple to things we all have in common:

  • Education (Everyone needs to go for education but the nature of that education can differ.)
    • Knowledge (the things we know)
    • Skills (how we use the knowledge)
    • Judgement (Choosing the right approach)
  • The challenge is - There are always new platforms, new tools, new languages as our field is growing rapidly.

In case of any other profession, if you stop learning, things will still work. But in fields like software development and information technology, we need to make learning as our habit and a passion too as if you don’t do it, your skills will be less valuable in the IT market.

Career of a Software Developer and some strategies to Survive

| Comments

If you are an software developer by profession or have hobby to develop in some languages, I guess you spend most of your time working on different technologies and updating your skills either by attending conferences, books and other sources. There are many things to learn and by the time we learn some of them, we again have lots of other new things in queue, that never ends! It is sometimes very difficult to how to work in such environment and keep learning and updating your skills. Everyone has this issue but very few talk about this! Geeks can talk a lot about comparing different technologies or the competition going on between Microsoft, Google or any other organisation. But wait, is this all a software developer can think of or should do? No, we are not taking care of many important factors that I am going to talk about here.