什么是 ConfigurationManager.AppSettings?
What is ConfigurationManager.AppSettings?
我正在使用 this, as a sample Authentication to try out. What I want to know is what happens in this 线路。即 ConfigurationManager.AppSettings["ActiveDirectory.ResourceId"])
。有人会好心解释一下吗?
您引用的 AuthBot 示例的 ActiveDirectory.ResourceId
应用设置是:
<add key="ActiveDirectory.ResourceId" value="https://graph.windows.net/" />
.ResourceId 是 graph.windows.net
而不是 graph.microsoft.com
的原因在这里有一些解释:https://github.com/matvelloso/AuthBot/pull/10
They are both valid. It only depends on which one you configure your
application in AAD for. Not everybody has Office 365 and therefore not
everybody will have graph.microsoft.com so I'd rather just leave it
with the option that is more likely going to work for most people
--Matt Velloso
您可以在 web.config 文件中为您的应用程序设置默认配置,并使用 ConfigurationManager.AppSettings 属性.
访问它们
例如
web.config
<configuration>
<appSettings>
<add key="highestScore" value="200" />
<add key="defaultSport" value="Cricket" />
</appSettings>
</configuration>
代码
int maxScore = Convert.ToInt32(ConfigurationManager.AppSettings["highestScore"]);
string Sport = ConfigurationManager.AppSettings["defaultSport"].ToString();
我正在使用 this, as a sample Authentication to try out. What I want to know is what happens in this 线路。即 ConfigurationManager.AppSettings["ActiveDirectory.ResourceId"])
。有人会好心解释一下吗?
您引用的 AuthBot 示例的 ActiveDirectory.ResourceId
应用设置是:
<add key="ActiveDirectory.ResourceId" value="https://graph.windows.net/" />
.ResourceId 是 graph.windows.net
而不是 graph.microsoft.com
的原因在这里有一些解释:https://github.com/matvelloso/AuthBot/pull/10
They are both valid. It only depends on which one you configure your application in AAD for. Not everybody has Office 365 and therefore not everybody will have graph.microsoft.com so I'd rather just leave it with the option that is more likely going to work for most people --Matt Velloso
您可以在 web.config 文件中为您的应用程序设置默认配置,并使用 ConfigurationManager.AppSettings 属性.
访问它们例如
web.config
<configuration>
<appSettings>
<add key="highestScore" value="200" />
<add key="defaultSport" value="Cricket" />
</appSettings>
</configuration>
代码
int maxScore = Convert.ToInt32(ConfigurationManager.AppSettings["highestScore"]);
string Sport = ConfigurationManager.AppSettings["defaultSport"].ToString();