<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rajan Karwal on Medium]]></title>
        <description><![CDATA[Stories by Rajan Karwal on Medium]]></description>
        <link>https://medium.com/@rajankarwal?source=rss-1a6d82e9da57------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*F-gm7-d48I3NDcUE.jpg</url>
            <title>Stories by Rajan Karwal on Medium</title>
            <link>https://medium.com/@rajankarwal?source=rss-1a6d82e9da57------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:49:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajankarwal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Installing Wordpress in a subdirectory in a .NET application]]></title>
            <link>https://medium.com/@rajankarwal/installing-wordpress-in-a-subdirectory-in-a-net-application-c41e3f8d7125?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/c41e3f8d7125</guid>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Thu, 02 Jun 2016 08:57:54 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:19.187Z</atom:updated>
            <content:encoded><![CDATA[<p>When you install Wordpress as a root web app using Web Platform Installer, everything just works. However, adding a Wordpress blog to a subdirectory (e.g. /blog) needs quite a few extra steps beyond the base install to get everything ‘working’.</p><h4>Installing PHP</h4><p>I used the PHP 7 32 bit. Before installing it you will need the Visual C++ Redistributable (again 32 bit)!</p><p><a href="https://www.microsoft.com/en-gb/download/details.aspx?id=48145">Visual C++ Redistributable for Visual Studio 2015</a></p><h4>Web.config in sub directory</h4><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;configuration&gt;<br>  &lt;system.webServer&gt;<br>    &lt;rewrite&gt;<br>      &lt;rules&gt;<br>      &lt;clear/&gt;<br>      &lt;rule name=&quot;wordpress&quot; patternSyntax=&quot;Wildcard&quot;&gt;<br>        &lt;match url=&quot;.*&quot;/&gt;<br>          &lt;conditions&gt;<br>            &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; negate=&quot;true&quot;/&gt;<br>            &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsDirectory&quot; negate=&quot;true&quot;/&gt;<br>          &lt;/conditions&gt;<br>        &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot;/&gt;<br>      &lt;/rule&gt;&lt;/rules&gt;<br>    &lt;/rewrite&gt;<br>  &lt;/system.webServer&gt;<br>&lt;/configuration&gt;</pre><h4>Web.config in root</h4><p>No changes required</p><h4>Permissions</h4><p>The web.config in the root must have a few permissions added to it before things will work. Add IUSR(Should already by on) and IIS_IUSRS. This will allow the subdirectory to access the parent.</p><h4>Virtual Application and App Pool</h4><ul><li>Remove the default application and app pool that the wordpress install created.</li><li>Create a new app pool (unmanaged code) and set the Identity (advanced settings) to LocalSystem</li><li>Re-add the virtual application and ensure you use the new app pool created above.</li></ul><h4>Uploads and Imports</h4><p>To enable uploads to work I had to make a few changes</p><ul><li>Php uploads to C:\Windows\Temp and then copies to the uploads directory. The problem is that the permissions get inherited. Create a new directory, add IIS_IUSRS permissions and update PHPini.php to point to this as the temp uploads folder.</li><li>Also in the wp-admin directory I found I needed to add a new phpini.php to allow for better memory management, as a relatively small data import would cause it to tank. Not sure if this is a required step but it seemed to help!</li></ul><pre>&lt;?php</pre><pre>phpinfo()</pre><pre>?&gt;</pre><pre>memory_limit = 128M</pre><pre>Summary</pre><pre>So there you have it. There is definitely a learning curve to this if you&#39;re not from PHP land, but overall the installation seems to be working!</pre><h4>Resources</h4><pre>A selection of resource that came in very handy to making this all happen!</pre><pre><a href="http://serverfault.com/questions/613927/500-error-on-fresh-install-of-iis-and-php">http://serverfault.com/questions/613927/500-error-on-fresh-install-of-iis-and-php</a></pre><pre><a href="http://www.mbrauchler.com/wordpress-image-upload-problem-using-iis-on-windows-server-2008/">http://www.mbrauchler.com/wordpress-image-upload-problem-using-iis-on-windows-server-2008/</a></pre><pre><a href="https://wordpress.org/support/topic/iis-image-upload-view-issues">https://wordpress.org/support/topic/iis-image-upload-view-issues</a></pre><pre><a href="http://stackoverflow.com/questions/14966871/second-wordpress-installation-on-iis-server">http://stackoverflow.com/questions/14966871/second-wordpress-installation-on-iis-server</a></pre><pre><a href="https://wordpress.org/support/topic/wordpress-installation-on-root-folder-sub-folder-on-iis-server-url-conflict?replies=5">https://wordpress.org/support/topic/wordpress-installation-on-root-folder-sub-folder-on-iis-server-url-conflict?replies=5</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c41e3f8d7125" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Good location services]]></title>
            <link>https://medium.com/@rajankarwal/good-location-services-85e7166bab27?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/85e7166bab27</guid>
            <category><![CDATA[utilities]]></category>
            <category><![CDATA[postcode]]></category>
            <category><![CDATA[location-services]]></category>
            <category><![CDATA[maxmind]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Tue, 19 Apr 2016 16:13:54 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:17.170Z</atom:updated>
            <content:encoded><![CDATA[<p>Location lookups are a part of pretty much every app these days, but I constantly find myself searching for good data providers or services to give me what I need. Here is a list of some good ones, some of which I have used first hand. Hopefully this will help someone hours of Googling!</p><p><a href="https://www.townslist.co.uk/">https://www.townslist.co.uk</a> — UK town list service, updated regularly, Paid</p><p><a href="http://www.sqldumpster.com/databases/geographic/">http://www.sqldumpster.com/databases/geographic/</a> — Many geo databases, infrequent updates, Free</p><p><a href="http://dev.maxmind.com/geoip/geoip2/geolite2/">http://dev.maxmind.com/geoip/geoip2/geolite2/</a> — The daddy of location services, not cheap, but fast and pretty accurate. Their CSVs are massive and can be a nightmare to tailor to your app.</p><p><a href="https://www.freemaptools.com/download-uk-postcode-lat-lng.htm">https://www.freemaptools.com/download-uk-postcode-lat-lng.htm</a> — UK postcode database, last updated 2015, Free</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85e7166bab27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web deploy and TLS V1.0]]></title>
            <link>https://medium.com/@rajankarwal/web-deploy-and-tls-v1-0-91f4011feb2c?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/91f4011feb2c</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Tue, 19 Apr 2016 13:36:18 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:18.354Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I have been using the excellent IISCrypto tool to lock down some servers for PCI compliance. One of the main steps in this process was to close off TLS V1.0. In the past on Windows 2008R2, this was a problem as disabling it used to kill RDP services too. However on Windows 2012 boxes, the default is TLS V1.2 so you can safely do this.</p><p>The gotcha came when using web deploy to push my applications to this server, connections failed to the server. <strong>This was a client issue</strong>. By default, my Windows 10 install seems to be defaulting to <strong>TLS V1.0</strong>.</p><p>To fix the issue, a registry edit is required. Simply create a .reg file with the exact content below, run it, happy days again.</p><pre>Windows Registry Editor Version 5.00</pre><pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]<br>&quot;SchUseStrongCrypto&quot;=dword:00000001</pre><pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]<br>&quot;SchUseStrongCrypto&quot;=dword:00000001</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91f4011feb2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use custom font in Azure web publish]]></title>
            <link>https://medium.com/@rajankarwal/use-custom-font-in-azure-web-publish-337771c6414f?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/337771c6414f</guid>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Tue, 23 Jun 2015 17:43:07 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:21.291Z</atom:updated>
            <content:encoded><![CDATA[<p>In your web.config, under &lt;system.webServer&gt;</p><pre>&lt;staticContent&gt;<br>      &lt;mimeMap fileExtension=&quot;.woff&quot; mimeType=&quot;font/woff&quot; /&gt;<br>&lt;/staticContent&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=337771c6414f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mailchimp inline post hack]]></title>
            <link>https://medium.com/@rajankarwal/mailchimp-inline-post-hack-51479571d5e2?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/51479571d5e2</guid>
            <category><![CDATA[mailchimp]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Mon, 22 Jun 2015 22:16:33 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:26.275Z</atom:updated>
            <content:encoded><![CDATA[<p>Mailchimp is my go-to signup service, but I do hate their default double opt in system and their landing pages which are basically really awkward to bypass unless you build your own forms using their API.</p><p>There is a way to ‘hijack’ their standard embed form by changing the form action to GET and send the data using JSON P. This returns you an inline response which you can handle without all their pesky screens and redirects.</p><pre>&lt;form action=&quot;http://yourlist.us6.list-manage.com/subscribe/post-json?u=bbbaafd1d12345c57b712345&amp;id=123456789e&quot;&gt;</pre><pre>$(&quot;#subscribe-form&quot;).submit(function(e){<br>    e.preventDefault();<br>    submitSubscribeForm($(&quot;#subscribe-form&quot;));<br>});</pre><p>Credit: <a href="http://pocketproduct.com/2014/a-better-mailchimp-signup/">http://pocketproduct.com/2014/a-better-mailchimp-signup/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51479571d5e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better looking Google Maps]]></title>
            <link>https://medium.com/@rajankarwal/better-looking-google-maps-4c0414d446d1?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c0414d446d1</guid>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Mon, 22 Jun 2015 22:08:46 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:27.294Z</atom:updated>
            <content:encoded><![CDATA[<p>Styling Google Maps is a bit of a pain and to be honest is normally low on the priority list for most designers. However I recently stumbled across Snazzy Maps which gives you a load of pre-skinned samples and a great editor to create some nice custom styles right in your browser. One for the bookmarks!</p><p><a href="https://snazzymaps.com/">Snazzy Maps - Free Styles for Google Maps</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c0414d446d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CallerMemberName attribute]]></title>
            <link>https://medium.com/@rajankarwal/callermembername-attribute-7d327016c43c?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d327016c43c</guid>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Wed, 10 Dec 2014 18:24:27 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:25.316Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I created a WebApi where the client wanted to know what the original method name was when getting a response back.</p><p>I found a cool way to do it which .NET 4.5 offers.</p><p>The [CallerMemberName] attribute can be added as an optional parameter to any method and give you access to the calling methods name.</p><pre>public class SomeClass<br>{<br>    public void SomeMethod([CallerMemberName]string memberName = &quot;&quot;)<br>    {<br>        Console.WriteLine(memberName); //output will me name of calling method<br>    }<br>}</pre><p>You can access some other useful properties too such as line number and even file path</p><pre>public void TraceMessage(string message,<br>        [System.Runtime.CompilerServices.CallerMemberName] string memberName = &quot;&quot;,<br>        [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = &quot;&quot;,<br>        [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)<br>{<br>    System.Diagnostics.Trace.WriteLine(&quot;message: &quot; + message);<br>    System.Diagnostics.Trace.WriteLine(&quot;member name: &quot; + memberName);<br>    System.Diagnostics.Trace.WriteLine(&quot;source file path: &quot; + sourceFilePath);<br>    System.Diagnostics.Trace.WriteLine(&quot;source line number: &quot; + sourceLineNumber);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d327016c43c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inheritance from derived classes with AutoMapper]]></title>
            <link>https://medium.com/@rajankarwal/inheritance-from-derived-classes-with-automapper-47bafad7b18f?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/47bafad7b18f</guid>
            <category><![CDATA[automapper]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Thu, 04 Dec 2014 21:35:46 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:20.425Z</atom:updated>
            <content:encoded><![CDATA[<p>Simple scenario. Base class is super simple and we have a derived class which adds some additional properties to it.</p><p>The problem is if you try to do a Mapper.CreateMap from your source to the DERIVED class, the properties of the base class are not include by default.</p><p>To achieve this:</p><pre>Mapper.CreateMap&lt;SourceClass, ExtendedClass&gt;().IncludeBase&lt;EventBase, EventExtended&gt;();</pre><p>Credit: <a href="https://github.com/AutoMapper/AutoMapper/wiki/Mapping-inheritance">https://github.com/AutoMapper/AutoMapper/wiki/Mapping-inheritance</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47bafad7b18f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strikethru in Trello]]></title>
            <link>https://medium.com/@rajankarwal/strikethru-in-trello-fdd772c2053c?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdd772c2053c</guid>
            <category><![CDATA[trello]]></category>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Thu, 04 Dec 2014 21:35:32 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:23.319Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes, Trello is great. Actually its flippin awesome and has pretty much changed the way I work and the tools I used to use.</p><p>Unfortunately Trello doesn’t fully support markdown, but does allow you to strikethru in certain areas which is a nice feature which seems to be very hidden.</p><p>Simply:-</p><p>~~yourdata~~</p><p>This doesn’t work on List names but does work within them, in checklists, cards and so on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdd772c2053c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OAuth Facebook, Twitter, LinkedIn, Instagram and more with WebApi and Identity 2]]></title>
            <link>https://medium.com/@rajankarwal/oauth-facebook-twitter-linkedin-instagram-and-more-with-webapi-and-identity-2-c8cb73ce56dd?source=rss-1a6d82e9da57------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8cb73ce56dd</guid>
            <dc:creator><![CDATA[Rajan Karwal]]></dc:creator>
            <pubDate>Fri, 28 Nov 2014 08:45:40 GMT</pubDate>
            <atom:updated>2017-03-03T23:18:22.385Z</atom:updated>
            <content:encoded><![CDATA[<p>The Identity 2 system includes OAuth connections for Facebook, Twitter and Google. These are easy enough to configure (well to do a simple register/login) from an MVC website project BUT doing this with Web Api needs a little more knowledge!</p><p>Firstly I’ll make reference to this excellent resource on configuring various OAuth providers.</p><p><a href="http://www.beabigrockstar.com/guides/aspnet-oauth">Beabigrockstar.com</a></p><p>So if you’ve followed this correctly you should have your API key/secret in your Startup.Auth file.</p><p><a href="http://stackoverflow.com/questions/21065648/asp-net-web-api-2-how-to-login-with-external-authentication-services">asp.net web api 2: how to login with external authentication services?</a></p><p>Now to use this with WebApi you need to make a call to</p><pre>GET /api/Account/ExternalLogins?returnUrl=%2F&amp;generateState=true</pre><p>This will return an object of all your registered OAuth providers along with a URL.</p><p>Make a GET request to this URL and you will be redirected to the providers login page which will eventually request the permissions you are needing for your app. (Typically this will be your client website or native app making this call)</p><p>e.g.</p><pre><a href="http://localhost:2000/api/Account/ExternalLogin?provider=Facebook&amp;response_type=token&amp;client_id=self&amp;redirect_uri=http%3A%2F%2Flocalhost%3A30756%2F&amp;state=YRN-9tp3XCn_PUmp6yMBHX896rRu_UOkA9xxxxxxxxx">http://localhost:2000/api/Account/ExternalLogin?provider=Facebook&amp;response_type=token&amp;client_id=self&amp;redirect_uri=http%3A%2F%2Flocalhost%3A30756%2F&amp;state=YRN-9tp3XCn_PUmp6yMBHX896rRu_UOkA9xxxxxxxxx</a></pre><p>Once authenticated, you will go back to your callback URL, which will look something like this or back to your native app.</p><pre><a href="http://localhost:30756/#access_token=SOMETOKENVALUE&amp;token_type=bearer&amp;expires_in=1209600&amp;state=SOMESTATEVALUE">http://localhost:30756/#access_token=SOMETOKENVALUE&amp;token_type=bearer&amp;expires_in=1209600&amp;state=SOMESTATEVALUE</a></pre><p>Notice the <strong>access_token</strong> and <strong>token_type</strong> values. So all we need to do now to parse this response and send an Authorized request to our protected Api controller using this token.</p><p>e.g.</p><pre>localhost:30756/api/account/userinfo</pre><p>or</p><pre>curl -H &quot;Authorization: OAuth &lt;ACCESS_TOKEN&gt;&quot; <a href="http://www.example.com/">http://www.example.com</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8cb73ce56dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>