This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DataAccess; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
using System; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace WebApplication_MultiTenant.CustomMiddleware | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rewrite> | |
<rules> | |
<rule name="ReverseProxyRule2" | |
enabled="true" stopProcessing="true"> | |
<match url="^Contact" /> | |
<action type="Rewrite" url="http://localhost:8021/Home/Contact" /> | |
</rule> | |
</rules> | |
</rewrite> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rewrite> | |
<globalRules> | |
<rule name="ReverseProxyRule1" | |
enabled="true" stopProcessing="true"> | |
<match url="^Contact" /> | |
<action type="Rewrite" url="http://localhost:8021/Home/Contact" /> | |
<conditions> | |
<add input="{SERVER_PORT}" pattern="88" /> | |
</conditions> | |
</rule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rewrite> | |
<outboundRules> | |
<!--the IsHTML pre-condition is defined at the global level | |
in the applicationHost.config--> | |
<rule name="AnchorFixer" preCondition="IsHTML" enabled="true" | |
stopProcessing="true"> | |
<match filterByTags="A" pattern="^/Home/(.*)" /> | |
<action type="Rewrite" value="/{R:1}" /> | |
</rule> | |
</outboundRules> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rule name="LinkNScriptFixer" preCondition="IsHTML" | |
enabled="true" stopProcessing="true"> | |
<match filterByTags="Link, Script" pattern="^/(css|js)/(.*)" | |
negate="false" /> | |
<action type="Rewrite" value="http://localhost:8021{R:0}" /> | |
</rule> | |
<rule name="FormActionFixer" preCondition="IsHTML" | |
enabled="true" stopProcessing="true"> | |
<match filterByTags="Form" pattern="^/(.*)/(.*)" /> | |
<action type="Rewrite" value="/{R:2}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rule name="FormSubmitter" enabled="true" | |
stopProcessing="true"> | |
<match url="^Submit" /> | |
<action type="Rewrite" | |
url="http://localhost:8021/Home/Submit" /> | |
</rule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rule name="ResponseLocationFixer" | |
preCondition="IsRedirection" | |
enabled="true" stopProcessing="true"> | |
<match serverVariable="RESPONSE_LOCATION" pattern="^/(.*)/(.*)" /> | |
<action type="Rewrite" value="/{R:2}" /> | |
</rule> | |
<preConditions> | |
<preCondition name="IsRedirection"> | |
<add input="{RESPONSE_STATUS}" pattern="3\d\d" /> | |
</preCondition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : HttpApplication | |
{ | |
private void Application_Start(object sender, EventArgs e) | |
{ | |
// Register application level routes here. | |
RouteConfig.RegisterRoutes(RouteTable.Routes); | |
BundleConfig.RegisterBundles(BundleTable.Bundles); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class RouteConfig | |
{ | |
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
var settings = new FriendlyUrlSettings(); | |
settings.AutoRedirectMode = RedirectMode.Temporary; | |
routes.EnableFriendlyUrls(settings); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
public IActionResult Contact() | |
{ | |
ViewData["Message"] = "Your contact page."; | |
return View(); | |
} | |
[HttpPost] |
OlderNewer