Thursday, 4 August 2016

How to get rendering view or action name in razor view

To get controller name:

ViewContext.RouteData.GetRequiredString("controller")

To get action name:

ViewContext.RouteData.GetRequiredString("action")

Friday, 1 January 2016

How to return Javascript from an ASP.NET MVC controller action

We can use ContentResult to return the content from the MVC controller action method

Public ActionResult Helloworld()
{
    return Content("<script language='javascript' type='text/javascript'>alert('Hello world!');
}

Extracting Nupkg files using command line

Rename it to zip first then extract files as below 1.     Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2.     Make sure to repla...