0
Answer

Role manager in Asp.Net

pradeep kumar

pradeep kumar

11y
1.8k
1
Hi..,
  I want to redirect to page based on the role...,
Im using Role manager in Web.config

here is my Web.Config file:

  <?xml version="1.0"?>
<!--
  Note: As an alternative to hand editing this file you can use the
  web admin tool to configure settings for your application. Use
  the Website->Asp.Net Configuration option in Visual Studio.
  A full list of settings and comments can be found in
  machine.config.comments usually located in
  \Windows\Microsoft.Net\Framework\vx.x\Config
-->
<configuration>
  <appSettings>
  <add key="ImgCancel" value="/images/icon_error.gif"/>
  <add key="ImgCheck" value="/images/icon_Check.png"/>

  </appSettings>

  <connectionStrings>
  <!--<add name="MGS.IGreens.DataAccess.Properties.Settings.ITrackConnectionString" connectionString="Data Source=.;Initial Catalog=ITrack;User Id=sa;Password=sa@1234;"/>-->
  <!--<add name="MGS.IGreens.DataAccess.Properties.Settings.ITrackConnectionString" connectionString="Data Source=.;Initial Catalog=ITrack;User Id=sa;Password=sa@123;"/>-->
  <add name="MGS.IGreens.DataAccess.Properties.Settings.ITrackConnectionString" connectionString="Data Source=.;Initial Catalog=ITrack;User Id=sa;Password=sa@1234;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
  <!--
  Set compilation debug="true" to insert debugging
  symbols into the compiled page. Because this
  affects performance, set this value to true only
  during development.
  -->
  <!--<identity impersonate="true" />-->
  <roleManager enabled="true" defaultProvider="MGS.IGreens.DataAccess.Properties.Settings.ITrackConnectionString">
  <providers>
  <clear/>
  <add name="MGS.IGreens.DataAccess.Properties.Settings.ITrackConnectionString" connectionString="Data Source=172.16.50.10;Initial Catalog=ITrack;User Id=sa;Password=sa@1234;" type="System.Web.Security.SqlRoleProvider" />

  </providers>

  </roleManager>
  <compilation debug="true" targetFramework="4.0">
  <assemblies>
  <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Web.RegularExpressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>
  </compilation>
  <!--
  The <authentication> section enables configuration
  of the security authentication mode used by
  ASP.NET to identify an incoming user.
  -->
  <authentication mode="Forms">
  <forms loginUrl="LoginPage.aspx" timeout="10" defaultUrl="~/Forms/Timesheet/TsSelfView.aspx"></forms>

  </authentication>
  <customErrors mode="Off"></customErrors>
  <!--
  The <customErrors> section enables configuration
  of what to do if/when an unhandled error occurs
  during the execution of a request. Specifically,
  it enables developers to configure html error pages
  to be displayed in place of a error stack trace.
  <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
  <error statusCode="403" redirect="NoAccess.htm" />
  <error statusCode="404" redirect="FileNotFound.htm" />
  </customErrors>
  -->
  <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <!--
  The system.webServer section is required for running ASP.NET AJAX under Internet
  Information Services 7.0.  It is not necessary for previous version of IIS.
  -->


</configuration>


aspx.cs Page:

 if(Roles.IsUserInRole(Login1.UserName,"TCS1249"))
  {
  Login1.DestinationPageUrl = "~/Forms/sheet/TsReviewerView.aspx";
 
 
 
  }


Im getting the error

"Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'."

need immediate help pls...,