Posts

Showing posts from 2019

Pass empty model to razor view

i needed to pass empty instance for a model i have to my razor view so Vue (as my client side) can use it, as i was avoiding re-type the whole model again. usually when you pass you model with values in ViewBag if you use @Html.Raw(ViewBag.ModelClass) Copy to Clipboard you get Json, but to my surprise that is not the case if it's just an empty no values instance, in that case this code will return the object name! to solve this i added Json.Serialize to the mix, so @Html.Raw(Json.Serialize(ViewBag.ModelClass)) Copy to Clipboard will return an empty value json representing the model empty instance.

add extra files on deploy ASP Core web app using publish profile

So i have been struggling with this for a while now. i used to be able to add file to my ASP .NET projects through publish profiles using the following customization <!--Cutome entry to include custom DLLs--> <target name="CollectHelpers"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\Custom*.dll"> <filesforpackagingfromproject include="%(_CustomFiles.Identity)"> <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> </filesforpackagingfromproject> </_customfiles> </target> <target name="CollectCustomizations"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\*Custom*.dll"> <filesforpackagingfromproject include="%(_CustomFiles.Identity)"> <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extensio...

.NET Core stdoutLog in web.config

So i am hosting my project  https://www.worknxt.com at host site which uses plesk, that dosen't give you broad access to logs which you need to look at spicealy if you .NET Core website which was working fine on your laptop 😀, now is not working at all on host! but thanks to stdoutLog that you can find in web.config you can have some idea on why your web app fail to start, the problem is even after setting this to true i didn't find any log created 😢 as always the problem came from my own expectations about how things should work, see the entry by default have a path of \logs\stdoutLog and i though well fine if .NET Core didn't find the folder it would create it, WRONG! see once i created the folder i got that stdoutLog and realized i was missing a DLL, now everything works just fine 😉

Historical name servers records

I recently bought a domain and used various free appraisal services to evaluate the domain name. To my surprise one of these services indicated the name have MOZ rank! So i thought this name must has been used/bought before. But how to verify that? A quick google search and i found this https://whoisrequest.com/history/ And i was right this domain name and actually another couple i own where created and dropped way back. Lucky me

VS 2019 is the last version of visual studio with load tests feature and coded UI tests feature

Image
Why Microsoft, why you do that, this is a beautiful piece of a tool that you are putting to waste. according to this . just open source it please, i mean look how good .NET Core is (in my own opinion)

S/MIME Certificate and GMail

So i was asked to have x.509 certificate for a client e-mail. that client happen to use Gmail, which do have a document on how to install that if you are using Gsuite. the problem is it's only enterprise version!, why for a simple feature like that i have to go enterprise level. i would say even free Gmail users should have the ability to use their own S/MIME Personal X.509 certificates to sign and encrypt e-mails.

AES Encryption Decryption .NET Core 2

So if you saw my earlier post about this the code there didn't work for me. but who know me knows i don't give up that easily, there might be a NuGet here or there that do this but i needed to know how this is done! so after 3 hours of digging code on the internet and trying the code for a dozen of times, below is the code which did work for me. i know that the IV should be dynamic in order to further protect this more and this is something i will work on. public static class Crypto { public static string EncryptString(string text, string keyString) { var key = Encoding.UTF8.GetBytes(keyString); var textToChiper = Encoding.UTF8.GetBytes(text); using (var aesAlg = Aes.Create()) { aesAlg.Padding = PaddingMode.PKCS7; aesAlg.Mode = CipherMode.CBC; aesAlg.KeySize = (key.Length * 8); aesAlg.IV = new byte[16]; aesAlg.Key = key; ...

Let's use a publish profile on that Azure Pipeline on TFS !

So we have TFS at work and i have been planning to create a build for a vendor web app which we used the DI the vendor implemented to inject our own custom modules/apps. i managed previously to create a customized publish profile to produce a web package that contain both the vendor DLLs and our own. <!--Cutome entry to include custom DLLs--> <target name="CollectHelpers"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\Custom*.dll"> <filesforpackagingfromproject include="%(_CustomFiles.Identity)"> <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> </filesforpackagingfromproject> </_customfiles> </target> <target name="CollectCustomizations"> <itemgroup> <_customfiles include="$(MSBuildProjectDirectory)\bin\*Custom*.dll"> <filesforpackagingfrom...

VSTS, VSO and Azure Devops

So i had the chance to explore Azure Devops and i must say i am impressed. i didn't test how much useful it's if we try hook it up to other hosts than Azure but for Azure i must say this is wonderfully working well with some minimum configuration required from my side. the only issue i did encounter while i was trying to setup a build pipeline for my app (.NET Core SDK v2.2.103) was the fact that for some reason this didn't work. digging deeper i found a slimier issue , instead of waiting for the solution i decided to lower the version to SDK 2.2.102 and it worked. now once i push or merge to master branch my solution get build and deployed to my Azure web app. all with minimal configuration from my side. Azure Devops in my opinion is the result of mixing Github and TFS and it do contian the best of both worlds.