<?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 Munesh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Munesh Kumar on Medium]]></description>
        <link>https://medium.com/@muneshkumar578?source=rss-3a88e769ff44------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OlLY0lgvm6gdVRE5</url>
            <title>Stories by Munesh Kumar on Medium</title>
            <link>https://medium.com/@muneshkumar578?source=rss-3a88e769ff44------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:28:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muneshkumar578/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[Reissue JSON Web Token (JWT) with Sliding Expiration using ASP.NET Core (C#)]]></title>
            <link>https://muneshkumar578.medium.com/reissue-json-web-token-jwt-with-sliding-expiration-using-asp-net-core-c-432119ceb657?source=rss-3a88e769ff44------2</link>
            <guid isPermaLink="false">https://medium.com/p/432119ceb657</guid>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[sliding-expiration]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Munesh Kumar]]></dc:creator>
            <pubDate>Sun, 25 Apr 2021 14:14:43 GMT</pubDate>
            <atom:updated>2021-04-25T14:14:43.580Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ll be going straight to the point on how to reissue a JSON Web Token (JWT) when it is close to expiration. The best thing is you can do this without any huge development effort. I assume here that you’ve configured JWT Bearer Auth. There are already many articles on implementing JWT Bearer Auth.</p><p><strong>What is Sliding Expiration?</strong></p><blockquote>Sliding expiration resets the expiration time for a valid authentication token if a request is made and more than half of the timeout interval has elapsed. If the token expires, the user must re-authenticate.</blockquote><p>We’ll add our own custom Sliding Expiration Middleware into the request pipeline of ASP.NET Core application.</p><blockquote>Middleware is generally encapsulated in a class and exposed with an extension method.</blockquote><p>You can read more about writing custom ASP.NET Core middleware <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-5.0">here</a>.</p><p>Consider the following SlidingExpirationMiddleware.cs class. We read Authorization header on each request and make sure that this is an authenticated request. If more than half of timeout interval has elapsed then we reissue a JWT token with a new expiration and send it back in the Set-Authorization header.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d680da4179990c45c2fefabb36d9ad0/href">https://medium.com/media/9d680da4179990c45c2fefabb36d9ad0/href</a></iframe><p>Obviously our client code needs to know that an updated JWT token may be returned inSet-Authorization header of any of our API responses.</p><p>The following extension method exposes the middleware through IApplicationBuilder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/074aa55aa7043c9ebb1ae0d6539b7527/href">https://medium.com/media/074aa55aa7043c9ebb1ae0d6539b7527/href</a></iframe><p>Now finally let’s call the middleware from Startup.Configure</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b808596c393d30673f798a7e2dd58808/href">https://medium.com/media/b808596c393d30673f798a7e2dd58808/href</a></iframe><p>That’s it… We’re done here.</p><p>There are other approaches as well like using Refresh Tokens etc. But I guess other approaches requires a bit of development and management effort. Wasn’t this approach easier..? I’d love to hear any improvement/feedback :)</p><p>Happy Coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=432119ceb657" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EF Core and SQL Server Full-Text Index in Migrations]]></title>
            <link>https://muneshkumar578.medium.com/ef-core-and-sql-server-full-text-index-in-migrations-8071364f6be9?source=rss-3a88e769ff44------2</link>
            <guid isPermaLink="false">https://medium.com/p/8071364f6be9</guid>
            <category><![CDATA[freetext]]></category>
            <category><![CDATA[ef-core]]></category>
            <category><![CDATA[fulltext-search]]></category>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[full-text-search]]></category>
            <dc:creator><![CDATA[Munesh Kumar]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 16:55:38 GMT</pubDate>
            <atom:updated>2021-03-15T16:55:38.844Z</atom:updated>
            <content:encoded><![CDATA[<p>Full-Text search in SQL Server lets you run queries against character-based data in SQL Server tables.</p><p>Currently, EF Core (2.1, 3.1 and 5.0) doesn’t support migrations to build full-text indexes and catalogs. So, with a bit of research I came up with a workaround and decided to put it up in a blog. You might found part of this story at some other sites too but here I’ve also discussed few issues which I faced.</p><p>You might will need to install full text search component otherwise; you’ll get an error saying “Full-Text Search is not installed…” For local SQL Server, I solved this error by following steps mentioned <a href="https://stackoverflow.com/a/65324669/13622084">here</a>.</p><p>Let’s say we have a Product entity that has Tags property (A comma delimited list of tags associated with the Product). And we would like to search a product based on a tag.</p><p><strong>class</strong> Product<br>{<br> <strong>public</strong> <strong>int</strong> Id { <strong>get</strong>; <strong>set</strong>; }<br> <strong>public</strong> <strong>string</strong> Tags { <strong>get</strong>; <strong>set</strong>; }<br>}</p><p>Create an empty migration by following command. It’ll create an empty migration provided you don’t have any other DB changes to be applied.</p><p>dotnet ef migrations add AnEmptyMigrationToAddFullText</p><p>Inside the Up method of newly created empty migration, we need to create full-text catalog and then full-text index as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*5JjVBVpfQEn8s_BHe0PgDA.png" /></figure><p>Note that PK_Products is the name of the unique key index on Products table. Make sure to specify valid key index otherwise; you’ll get an error. The KEY INDEX must be a unique, single-key, non-nullable column.</p><p>Now, update the database</p><p>dotnet ef database update</p><p>Use the FreeText and Contains function to write the full text query from EF. Here is one of the example using EF Core</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*ToyS1UCppLEdbCpHWHA3Zw.png" /></figure><p>You can read more about FreeText vs Contains at <a href="https://docs.microsoft.com/en-us/sql/relational-databases/search/query-with-full-text-search">here</a> and <a href="https://www.sitepoint.com/sql-server-full-text-search-protips-part-2-contains-vs-freetext/">here</a>.</p><p>Happy Coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8071364f6be9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Vue CLI for Multi-Paged App Inside an ASP.NET Core Project]]></title>
            <link>https://muneshkumar578.medium.com/using-vue-cli-for-multi-paged-app-inside-an-asp-net-core-project-d40eda971880?source=rss-3a88e769ff44------2</link>
            <guid isPermaLink="false">https://medium.com/p/d40eda971880</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[mpa]]></category>
            <dc:creator><![CDATA[Munesh Kumar]]></dc:creator>
            <pubDate>Sun, 20 Dec 2020 17:56:56 GMT</pubDate>
            <atom:updated>2020-12-20T17:56:56.741Z</atom:updated>
            <content:encoded><![CDATA[<p>Not every app has to be an SPA, so; recently I came across a situation where I needed Vue.js for multi-paged app inside an ASP.NET Core project. Unfortunately, I couldn’t find anything that tackled this. Here is how I managed to do it. It might not be a best approach but it’s at least one of the way.</p><p>Before starting, I would mention here that this story will also help you to integrate Vue.js for SPA inside an ASP.NET Core project as well. I’ll tell you where to stop ;). So if you’re in this boat then go ahead.</p><p>I’m assuming that your ASP.NET Core project is already created and you’ve <strong>Vue CLI </strong>installed. And you’re using Visual Studio :)</p><p>Lets start with creating a simple Vue project. Open your console and go to your project directory and run below command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*oHaNxVT-1mL6GBwyFjk4sA.png" /></figure><p>When you run this command, it would probably ask for version. I’ve created using Default (Vue 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*tOm2jJzzlQ9l0r60ByEy9Q.png" /></figure><p>You should now end up with a structure like below. At this stage, the ‘dist’ folder will be missing at your end. Don’t worry ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*wZsYbOvMXO7D9kiqz-K8tw.png" /></figure><p>Now go to your client-app folder and build your project. I’m using npm to build this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*Xc--UtUzwJ5pvH3lBH1sOA.png" /></figure><p>When you run this build, you would notice that the dist folder is created. But as we know with ASP.NET Project we need build results inside wwwroot. So, we’ll make some changes here. Create a new file inside client-app directory by name <strong>vue.config.js </strong>and mention the output directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*R9YvIhO7GXQQOQ3xJDzf7Q.png" /></figure><p>Now when we build this project again we would end up in wwwroot directory. While we work we want our project to be rebuild automatically, so; lets add watch command inside package.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*vBG8xb-6V4KXtrnvO_HeYA.png" /></figure><p>Now if you run your ASP.NET Core project with <strong>ctrl+f5 </strong>, you would notice that you would also get your client-app’s build and it would ultimately slow down things. Instead you want this to happen only when deployment or publishing happens. So, lets tell MSBuild to do so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*hwhNoaAqt2Zsz5XRNFXrcg.png" /></figure><p>If you’re looking for Vue SPA inside an ASP.NET Core project then you can stop your working here.</p><p>Lets start our implementation for MPA. Add <strong>pages</strong> section inside vue.config.js file. Each “page” should have a corresponding JavaScript entry file. For proper understanding, I’ve added two pages in my app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*vlh95T76F-cPepZDIGDDaQ.png" /></figure><p>You can read more about pages <a href="https://cli.vuejs.org/config/#pages">here</a>.</p><p>And your directory should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*IANaVg3YbxcKiQFEEP-T_Q.png" /></figure><p>I hope you haven’t forgotten to build your client-app at this point. Now in order to call /products page you would need to create ASP.NET View. Let say your view path is ‘/Products/Index’ then inside your Index.cshtml add the following scripts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*PEiUcKERWCuuIo76xzPtYA.png" /></figure><p>Now run your ASP.NET project and go to ‘/Products/Index’. You would get your content rendered there…!</p><p><strong>Conclusion</strong></p><p>I know its not the perfect :) but it’s certainly a way to use Vue CLI with ASP.NET Core.</p><p>You can get the source here:</p><p><a href="https://github.com/muneshkumar578/VueMPAAndCore">GitHub Repo</a></p><p>I’d love to hear any improvement/feedback :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d40eda971880" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>