Category Archives: Codes & Scripts

MVC – What is the Purpose of [ActionName()]

MVC – What is the Purpose of [ActionName()]

I was very curios about the purpose of ActionNameAttribute in these past 3 days and I worked around a lot to find something about it. I will try to tell a little about  if you don’t  know this attribute. When you give this attribute to an Action , the Action (Method) Name  cannot be used at View part

Read More

Distributing Certificates via Bat or Exe file

Distributing Certificates via Bat or Exe file

You can distribute the bat or exe file which is created with the batch command below via Active Directory @echo off certutil -addstore -f -enterprise -user root %temp%\Cert-RootCA.cer > NUL certutil -addstore -f -enterprise -user root %temp%\Cert-SubCA.cer > NUL del /F %tmp%\Cert-RootCA.cer > NUL del /F %tmp%\Cert-SubCA.cer > NUL del /F %tmp%\installcert.bat > NUL   Please

Read More

C# : In Linq querying the equality of an entity object that returns null and a variable that returns null needs Ternary Operation

C# : In Linq querying the equality of an entity object that returns null and a variable that returns null needs Ternary Operation

Let’s say we have a method like at the below , public int GetTheUserID(stringlogin, string email, boolisAD) { try { if(pass== null) { } if(query.Any()) query = query.Where(x => (x.LoginName== login) && (x.Email== email) && (isAD == x.ADUser) && (x.Deleted== false)); elsequery = Entity.SecurityUsers.Where(x => (x.LoginName== login) && (x.Email== email) && (isAD == x.ADUser) && (x.Deleted==

Read More

C# : IQueryable  ve null anahtarı

C# : IQueryable ve null anahtarı

IQueryable generic interface’i ile oluşturulmuş bir listeye yada dönen herhangibir query’ye içeriğinin null olup olmadığını nasıl sorarsınız ? bu tür generic tipler’in içerisine genellikle Linq(Lambda Expressions) lar ile bir sorgu dizisi atılır. Ve gün gelir bunun içinin “boş olma ihtimali”,  daha doğrusu;- yanlış olmasın-  içerisinde herhangibir sorgu öğesinin bulunup bulunmadığı kontrol edilmek istenir . Yapılan hata

Read More