Genesys Source
RSS

Blog

Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class?
Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class? By default, the DataContractJsonSerializer class expects dates in the format of Date(ticks). This is problematic, because ASP.NET Web API returns dates in ISO 8601 format. * Default date: "{\"BirthDate\":\\\/Date(248860800000-0800)\\/\ * ISO 8601 date: "{\"BirthDate\":\"1982-11-16T00:00:00-08:00\"}"
Did You Know that you can capture results from a Stored Procedure into a Table variable?
Did You Know that you can capture results from a Stored Procedure into a Table variable? -- Save Time Range in central stored procedure DECLARE @Result TABLE (ID INT) InsertInto @Result Exec [Entity].[TimeRangeSave]@BeginDate, @EndDate, @ActivityID Select @TimeRangeID = ID From @Result
Did You Know that you can clear MVC TextboxFor default values?
If you like strongly-typed Views...the trick is the Value Html attribute. Not “value”, “Value”. For example: @Html.TextBoxFor(m => m.BirthDate, "{0:MM/dd/yyyy}", new { @id = "txtBirthDate", @class = "form-control BirthDate", @Value = Model.BirthDate == "01/01/1900" ? "" : Model.BirthDate.ToString(), @placeholder = "MM/DD/YYYY" })
Powershell-Copy-Item-With-Folders
Recently, my Continuous Integration Powershell scripts began failing with the following error messages: [error]Copy-Item : Container cannot be copied onto existing leaf item. The fix: Get-ChildItem -Path $Source | Copy-Item -Destination $Destination -Recurse -Container
How-to: Use Visual Studio SQL Server Data Tools (SSDT)
This article describes the process of developing the entire Data Tier in Visual Studio SQL Server Data tools (SSDT.) Many Software Development Life Cycle (SDLC) processes use hand-coded SQL publish scripts when making changes to the data tier. This process is error prone, and is not able to be versioned as easily as C# code projects. SSDT is a technology that brings the data tier in-line with C# projects, and both can be developed, versioned and released in the same manner.
How-to: Upload a SSRS Report Developed in Visual Studio
This article describes how to upload your Visual Studio developed SQL Server Report Services (SSRS) RDL file from your local machine to a SSRS server. This procedure was developed for Visual Studio 2015 and SQL Server 2014, but also works with versions as old as 2010/2012.
How-to: Add ClickOnce Setup and Deployment to your App
ClickOnce will auto-manage everything about desktop-app deployment, updating and execution. You can start an app via Url, everything else is automatic. Running an exe Url like this will: http://www.domain.com/ProductSetupFolder/MajorVersion/Setup.exe •Verify OS, security, permissions requirements •Auto-install .Net Framework and all 3rd party dependencies •Auto-install the app •Auto-update the app when newer versions exist on the server •Auto-run the app
How-to fix: Attempt by security transparent method WebMatrix.WebData.PreApplicationStartCode.Start()

Visual Studio compile and runtime error: Attempt by security transparent method ‘WebMatrix.WebData.PreApplicationStartCode.Start()’ to access security critical method ‘System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)’ failed.

After upgrading Visual Studio to 2015, and projects from MVC 4.x to MVC 5.x, a few projects threw the following compile time and/or runtime error: Attempt by security transparent method ‘WebMatrix.WebData.PreApplicationStartCode.Start()’ to access security critical method ‘System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)’ failed.

To fix this initial error, upgrade WebHelpers via Nuget:

Install-Package Microsoft.AspNet.WebHelpers

Then it is likely you will receive this error after the nuget command: Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

To fix this new error, upgrade WebPages via Nuget:

Install-Package Microsoft.AspNet.WebPages.Data

Hope this helps!

SQL Server Data Tools Error: The script file could not be found

SQL Server Data Tools Error: The script file could not be found

SQL Server Data Tools Error: The script file could not be found

SSDT reported an error upoin trying to Publish my SQL Server Database project to a dev SQL Server: The script file could not be found

Blog-SSDTScriptFile

The fix ended up to be extremely simple: Delete the {Project Name}.dbmdl file in the project folder.

Hope this helps!

How-to: Generate an ASP.Net Machine Key

How-to: Generate an ASP.Net Machine Key

Using a third-party to generate an ASP.Net machine key is risky, as the third party now has access to your public IP and the generated machine key. But what is a secure way to generate your machine key?

IIS Administration to the Rescue!

The answer is simple. Use the IIS Administration portal to generate your machine keys. This method is 100% local to your corporate infrastructure, and not shared with anybody but you!

  1. Log onto a system that has IIS 7/8+ installed.
  2. In IIS Admin, click the server name in the left tree.
  3. Click the MachineKey icon in the right content pane.
  4. In the Machine Key window, click Generate Keys.
  5. Now copy/paste the Validation Key and Decryption Key into your app's web.config file.

Tips

  • I never allow IIS to modify either the machine.config nor my sites web.config. Clicking Generate Keys will not modify .configs. But clicking Apply will.
  • You may want to learn more about encryption method.
  • Machine Keys provide additional Web Site security. I use the machine key to allow the same Forms Auth logon to work on two different sites.

More Info: MSDN Machine Key

Enjoy!