Thursday, December 20, 2012

@Html.ActionLink to call action in different controller

@Html.ActionLink has many overloads (at least 17), and so sometimes it becomes confusing if the operation is not so straight-foward. 

For example, if you want to execute an Action of different controller, you must take care to use it like following:

@Html.ActionLink("Link Text", "MyAction", "MyController", new {id = item.ID}, null)
 

Its important to pass the last parameter (which is, "hostname"),
eventhough if you pass it as "null". Doing this will take up proper overload and will call the action from different controller.


Friday, December 7, 2012

Investigations:Could not load file or assembly or one of its dependencies.An attempt was made to load a program with an incorrect format.

ERROR: Could not load file or assembly or one of its dependencies.An attempt was made to load a program with an incorrect format. 

Developers generally face this issue in production server, or running a web application under IIS.
The site works fine in the integrated development environment, but fails and giving this error while running it in IIS.
The most likely reason of this issue is the incompatibility of target platforms. 
Say, your  application is targettng to only x32, but the dependent assembly targets to "Any CPU", or vice versa.

In order to fix this issue, you need to change settings of relevant Application Pool in IIS, to allow 32-bit applications.



This should resolve the issue.