Category Archives:

.htaccess equivalent in .NetCore

To allow video to be played in element from my website, but not allowing it through direct link, I created .htaccess in a sub-directory with the source videos, and nothing else. with the below code:

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(mp4|mp3|avi)$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteRule ^.* - [F,L]

I need to do the same with .NetCore server, but do not know how?

Any help. thanks.

Why does my iis url rewrite rule not work

I am trying to craft a rewrite rule to rewrite a Web Forms Request

To MVC-Core

I have created the rewrite rule

    <rule name="Unlock" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="Members/Unlock.aspx" />
        <add input="{QUERY_STRING}" pattern="contentID=([^&amp;]+)" />
      <action type="Redirect" url="Unlock" redirectType="Found" appendQueryString="True" />

But the URL does not rewrite. I guess I'm not matching the correct pattern. The MVC Unlock controller action signature is

    public IActionResult Index(string version, string computerName, string registrationId, int CALs, string message = null)