Geeks With Blogs
Developers Friendly .NET
ASP.NET Security – Custom Error Handling
Any application we built, will not be completely error free. Application will throw an exception at one or other point. Its a good practice to handle such exception in a way that it wont expose any critical information that would invite hackers. When an error occurred in application if its not handled properly, it will show up many critical information like Physical path, Framework version number, internal implementation(code) and other information. (Refer below image) This can be avoided by enabling ......

Posted On Thursday, February 5, 2015 6:34 AM

Windows Authentication in Asp.Net Web Application
When we are building any intranet web application, it is always better go with windows authentication in order to authenticate user against AD(Active Directory). With windows authentication enabled its very easy to authenticate and authorize user. To enable Windows Authentication in Asp.Net web application below changes need to be done: Set authentication mode to “Windows” and impersonate to “True” in web.config file under <system.web> node Or the same can be done in IIS. For that, select web ......

Posted On Tuesday, September 23, 2014 12:57 AM

Creating website in remote server using PowerShell from .NET application
Hi,Through this post i am trying to demonstrate how to access remote server and create web applications on any given server using PowerShell script from .NET application. Which involves passing values as parameters and executing ps1 script and accessing result set returned from ps1 script.The same can be achieved using .Net class "ServerManager" class, however which requires lot of settings that need to be done and we might get into lot of permission issues.Below is the sample code to call ps1 script ......

Posted On Friday, January 3, 2014 1:53 AM

Updating Web.config Programmatically
This post will demonstrate about updating web.config file dynamically. Below is the code snippet.string key = "iSourceID";string value = "This is my New Value!";string path = targetDirectory + "\\Web.config" ;var config = ConfigurationManager.OpenMa... ExeConfigurationFileMap() { ExeConfigFilename = path }, ConfigurationUserLevel.None... element = config.AppSettings.Settings... (element == null){ config.AppSettings.Settings... value);}else{ element.Value = value;}config.Save(Configur... ......

Posted On Tuesday, December 10, 2013 6:38 AM

Hosting WCF Service on IIS8
With this article, i am trying to elaborate the problems i faced while hosting WCF service on a Windows Server and on an IIS8. Hope this helps any one. Step1: Once I setup an application in IIS and try to browse, i got below error. This Error shows up as dependency dll was not available on server machine. Problem 1: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad36... or one of its dependencies. The system cannot find the ......

Posted On Sunday, December 8, 2013 12:35 PM

JSON Deserializing With null
When deserializing any JSON string to corresponding Object, if any value contains null, deserialization error occurs. To avoid such error one should use new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore}); Example: MyEntity deserializedObj = (MyEntity)JsonConvert.Deser... typeof(MyEntity), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore});... ......

Posted On Thursday, December 5, 2013 1:32 AM

SqlDbType to CLR Type
Below are the list of SqlDbType and equivalent CLR type, which will be mostly used while passing parameter to Stored Proc. SqlDbType CLR Type SqlDbType.Binary SqlDbType.Image SqlDbType.Timestamp SqlDbType.VarBinary typeof(byte[]) SqlDbType.Char SqlDbType.NChar SqlDbType.NText SqlDbType.NVarChar SqlDbType.Text SqlDbType.VarChar SqlDbType.Xml typeof(string) SqlDbType.DateTime SqlDbType.SmallDateTime SqlDbType.Date SqlDbType.Time SqlDbType.DateTime2 typeof(DateTime?) SqlDbType.BigInt typeof(long?) SqlDbType.Bit ......

Posted On Wednesday, September 11, 2013 10:52 PM

Deferred and Immediate Execution in LINQ
LINQ (Linear Integrated Query) in used to query the datasource against some specific condition. The main purpose of using this LINQ is to avoid the process of visiting each object and check condition and perform operation, which is costlier and time consuming. Below is the example query. LINQ query execution will take place in two way, Deferred Execution Immediate Execution Deferred Execution: In Deferred execution, the execution will take start when we start using “peopleList” (See above sample ......

Posted On Sunday, August 4, 2013 8:20 AM

Named and Optional Parameter
.NET provides an useful feature call as named & optional parameter. With the help of this we can avoid getting in to situation, where accidentally changing the position of parameter and getting in to logical error. And in order to call specific function by changing value couple of parameters and retaining values of other parameter we will pass all parameters with default value or null or “”. Named Parameter: In named parameter, we will pass value to parameter be referring name of the parameter ......

Posted On Monday, July 29, 2013 2:32 PM

.Net Execution Process
With this post, i am trying to explain the execution process of .Net application. What is the difference between .Net application and other application, what exactly that differentiate between .Net application and other application. Normally every file in operating system will have two parts, one is file header (which will also be called as Section Header) and file content. When it comes to .Net application , it contains an extra header (i.e, CLR Header). If any application that has CLR header then ......

Posted On Monday, June 17, 2013 2:11 PM

Copyright © Manjunath K | Powered by: GeeksWithBlogs.net