小编Eri*_*ric的帖子

在运行.NET 4的IIS 7上找不到默认角色提供程序

大家早上好,

我试图在我的Web应用程序中实现我的自定义成员资格和角色提供程序,我已在IIS 7的实例中的默认网站下实现.我的Web应用程序在.NET 4应用程序池下运行.

但是,在设置相应的web.config后,我收到以下错误:

Parser Error Message: Default Role Provider could not be found.
Run Code Online (Sandbox Code Playgroud)

我在相应的Web应用程序的web.config的system.web部分中包含了以下代码块:

<membership defaultProvider="CustomMembershipProvider" userIsOnlineTimeWindow="20">
 <providers>
  <clear/>
  <add name="CustomMembershipProvider" type="CustomProviders.CustomMembershipProvider,   
     CustomProviders, Version=3.0.0.0, Culture=neutral, 
     PublicKeyToken=3563615169617648" applicationName="/"/>
 </providers>
</membership>

<roleManager enabled="true" defaultProvider="CustomRoleProvider">
  <providers>
   <clear/>
   <add name="CustomRoleProvider" type="CustomProviders.CustomRoleProvider, 
     CustomProviders, Version=3.0.0.0, Culture=neutral, 
     PublicKeyToken=3563615169617648" applicationName="/"/>
  </providers>
</roleManager>
Run Code Online (Sandbox Code Playgroud)

现在我已经看到各种解释如何解决我之前提到的错误.他们中的大多数人似乎都建议我在我的提供者块中添加标签.有些人似乎建议我从machine.config中删除角色管理器.有些人似乎还建议不要删除或添加任何内容.最后一种方法似乎并不能说明我的Web应用程序是从IIS而不是本地计算机运行的.

最后,我尝试了这些方法,但收效甚微.有人可以向我解释我怎么能通过这个错误?提前致谢!

c# iis web-applications roleprovider membership-provider

4
推荐指数
1
解决办法
6431
查看次数

如何从查询字符串中检索多个GET变量?

GET在两个ASP.NET网站之间传递变量.在过去,我总是使用HttpContext.Current.Request.QueryString["VARIABLE_NAME"]HttpContext.Current.Request.Params["VARIABLE_NAME"]从查询字符串中读取变量,但我现在需要在查询字符串中传递两个不同的变量,如下所示:

http://sampleurl.com/Default.aspx?VariableA=ValueA?VariableB=ValueB

我的问题是HttpContext.Current.Request.QueryString["VariableA"]将返回整个查询字符串开头VariableA并继续VariableB.

我可以获取整个查询字符串,将其拆分为变量名称,然后读取结果值,但这似乎很草率.有没有更优雅的解决方案GET通过C#读取多个变量?

c# asp.net get

1
推荐指数
1
解决办法
1203
查看次数