C# 如何通过自定义属性获取配置文件?

C# 如何通过自定义属性获取配置文件?,c#,asp.net,profile,asp.net-profiles,C#,Asp.net,Profile,Asp.net Profiles,如何使用InvitationCode=“foo”获取配置文件? 还可以使属性唯一吗?这取决于您是否有网站或web应用程序,可能有两种方法。 用于网站Profile.InvitationCode和Profile.GetPropertyValue(“InvitationCode”),用于web应用程序 <profile enabled="true" automaticSaveEnabled="false"> <properties> <add name="I

如何使用InvitationCode=“foo”获取配置文件?
还可以使属性唯一吗?

这取决于您是否有网站或web应用程序,可能有两种方法。 用于网站
Profile.InvitationCode
Profile.GetPropertyValue(“InvitationCode”)
,用于web应用程序

<profile enabled="true" automaticSaveEnabled="false">
  <properties>
    <add name="InvitationCode" type="String"/>
  </properties>
</profile>