@manhng

Welcome to my blog!

ASP.NET appSettings Element

October 10, 2019 16:48

ASP.NET appSettings Element

https://docs.microsoft.com/en-us/previous-versions/aspnet/hh975440(v=vs.120)?redirectedfrom=MSDN

Use aspnet:UseHostHeaderForRequestUrl instead of custom MVC route handler

https://www.reddit.com/r/dotnet/comments/6od8vm/how_to_get_the_correct_requesturl_when_behind_a/

Get original url without non-standard port (C#) - Stack Overflow

https://stackoverflow.com/questions/7674850/get-original-url-without-non-standard-port-c

A more desirable solution for many ASP.NET applications may be to set the aspnet:UseHostHeaderForRequestUrl appSetting to true.

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />

A quick note about ASP.NET MVC Url Helpers

If you’re using some of the Url Helpers in asp.net mvc, like Url.Action in one of your controllers, you may run into an issue where the generated url will contain a non public port number. In that case, you can just add a setting to your config value as noted here:

http://support.appharbor.com/kb/getting-started/workaround-for-generating-absolute-urls-without-port-number

Setting aspnet:UseHostHeaderForRequestUrl 

to true should remedy the issue.

It should look something like this:

<appSettings>

….

<add key=”aspnet:UseHostHeaderForRequestUrl” value=”true”/>
</appSettings>

ASP.NET Core 3.0 + Web API + MongoDB

https://github.com/dj-nitehawk/MongoWebApiStarter/

.Net Core Web Api – Basic Authentication

https://hintdesk.com/2018/08/10/net-core-web-api-basic-authentication/

https://bitbucket.org/hintdesk/dotnet-asp.net-web-api-and-asp.net-identity/src/default/ (Source Code)

eBooks

https://www.amazon.com/b?_encoding=UTF8&site-redirect=&node=5&tag=rongblog-20&linkCode=ur2&camp=1789&creative=9325

Source code from Microsoft

https://referencesource.microsoft.com/

https://github.com/microsoft/referencesource/

http://www.dotnetframework.org/Search.aspx

Categories

Recent posts