How to change the value of attribute in appSettings section with Web.config transformation

You want something like: <appSettings> <add key=”developmentModeUserId” xdt:Transform=”Remove” xdt:Locator=”Match(key)”/> <add key=”developmentMode” value=”false” xdt:Transform=”SetAttributes” xdt:Locator=”Match(key)”/> </appSettings> See Also: Web.config Transformation Syntax for Web Application Project Deployment

What is an IIS application pool?

Application pools allow you to isolate your applications from one another, even if they are running on the same server. This way, if there is an error in one app, it won’t take down other applications. Additionally, applications pools allow you to separate different apps which require different levels of security. Here’s a good resource: … Read more

Exposing localhost to the internet via tunneling (using ngrok): HTTP error 400: bad request; invalid hostname

Troubleshot this issue with ngrok. In the words of inconshrevable, some applications get angry when they see a different host header than expected. Running the following command should fix the problem: ngrok http [port] -host-header=”localhost:[port]” Depending on the version, you may also want to try: ngrok http [port] –host-header=”localhost:[port]”

How to Convert JSON object to Custom C# object?

Since we all love one liners code Newtonsoft is faster than java script serializer. … this one depends on the Newtonsoft NuGet package, which is popular and better than the default serializer. if we have class then use below. Mycustomclassname oMycustomclassname = Newtonsoft.Json.JsonConvert.DeserializeObject<Mycustomclassname>(jsonString); no class then use dynamic var oMycustomclassname = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(jsonString);

WCF on IIS8; *.svc handler mapping doesn’t work

More specifically: Run Server Manager (on task bar and start menu) Choose the server to administer (probably local server) Scroll down to “Roles and Features” section. Choose “Add Role or Feature” from Tasks drop down On “Add Role or Feature Wizard” dialog, click down to “Features” in list of pages on the left. Expand “.Net … Read more

Accessing Session Using ASP.NET Web API

MVC For an MVC project make the following changes (WebForms and Dot Net Core answer down below): WebApiConfig.cs public static class WebApiConfig { public static string UrlPrefix { get { return “api”; } } public static string UrlPrefixRelative { get { return “~/api”; } } public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: “DefaultApi”, routeTemplate: … Read more

Hidden Features of ASP.NET [closed]

While testing, you can have emails sent to a folder on your computer instead of an SMTP server. Put this in your web.config: <system.net> <mailSettings> <smtp deliveryMethod=”SpecifiedPickupDirectory”> <specifiedPickupDirectory pickupDirectoryLocation=”c:\Temp\” /> </smtp> </mailSettings> </system.net>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)