'System.Web.Security.SqlMembershipProvider' - asp.net

I am running my website on IIS. The default page shows this message:
Server Error in '/Enterprise/EnterpriseASP' Application.
Unable to cast object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.InvalidCastException: Unable to
cast object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.
Source Error:
Line 78: Line 79: Protected
Overrides Sub OnLoad(ByVal e As
System.EventArgs) Line 80:
MyBase.OnLoad(e) Line 81:
Helper.WireViews(Me) Line 82:
End Sub
Source File:
C:\Enterprise\EnterpriseASPClient\Core\PageBase.vb
Line: 80
Stack Trace:
[InvalidCastException: Unable to cast
object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.]
Login.Page_Load(Object sender,
EventArgs e) +607
System.Web.UI.Control.OnLoad(EventArgs
e) +99
EnterpriseASPClient.Core.PageBase.OnLoad(EventArgs
e) in
C:\Enterprise\EnterpriseASPClient\Core\PageBase.vb:80
System.Web.UI.Control.LoadRecursive()
+47 System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +1436
How can this problem be solved?

Looks like you're incorrectly trying to cast (either explicitly or implicitly) an object of type System.Web.Security.SqlMembershipProvider to type EnterpriseASPClient.Core.EnterpriseMembershipProvider.
Please provide a little more detail about what's actually going on in your program.
I'm guessing your overridden OnLoad() function - or actually the Helper.WireViews() method it calls - is doing something inadvisable with casting.

If you're using a custom AccountMembershipProvider, remember you need to set this in your web config:
<membership defaultProvider="AccountMembershipProvider">
<providers>
<clear/>
<add name="AccountMembershipProvider" type="Foo.Bar.AccountMembershipProvider"/>
</providers>
</membership>

Related

Server Error in '/' Application. Could not find a part of the path

I'm trying to delete XML files on button click, the files are in the XML folder on my site (in smarterasp.net hosting) using this code :
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click
Dim directoryName As String = MapPath("~/xml/")
For Each deleteFile In Directory.GetFiles(directoryName, "*.xml", SearchOption.TopDirectoryOnly)
File.Delete(deleteFile)
Next
Label1.Text = "done"
End Sub
but I got this error :
Server Error in '/' Application.
Could not find a part of the path 'C:\Windows\SysWOW64\inetsrv\karary-001-
site1.htempurl.com\xml'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a
part of the path 'C:\Windows\SysWOW64\inetsrv\karary-001-
site1.htempurl.com\xml'.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[DirectoryNotFoundException: Could not find a part of the path
'C:\Windows\SysWOW64\inetsrv\karary-001-site1.htempurl.com\xml'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +219
System.IO.FileSystemEnumerableIterator`1.CommonInit() +268
System.IO.FileSystemEnumerableIterator`1..ctor(String path, String
originalUserPath, String searchPattern, SearchOption searchOption,
SearchResultHandler`1 resultHandler, Boolean checkHost) +434
System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption
searchOption) +86
WebApplication1.addTimetable.Button4_Click(Object sender, EventArgs e) in
C:\Users\MONZER\Desktop\Karary Web
Site\WebApplication1\addTimetable.aspx.vb:65
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9815014
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+204
what is right way to get the folder, I have tried those :
1- http://karary-001-site1.htempurl.com/xml/
2- h:\root\home\karary-001\www\site1\xml\
3- ~/xml/

The Security Support Provider Interface (SSPI) negotiation failed

I have error for my custom asp.net
my code asp code:
IServiceConfiguration<IOrganizationService> orgConfigInfo =
ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(new Uri("http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc"));
var creds = new ClientCredentials();
creds.UserName.UserName = "user";
creds.UserName.Password = "pass";
using (_serviceProxy = new OrganizationServiceProxy(orgConfigInfo, creds))
{
// This statement is required to enable early-bound type support.
_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
_service = (IOrganizationService)_serviceProxy;
using (context srv = new context(_service))
{
Account acc = new Account();
acc.thr_FirstName = firstname.Text;
acc.thr_LastName = lastname.Text;
acc.thr_NationalCode = nationalcode.Text;
acc.EMailAddress1 = email.Text;
acc.thr_Mobile = cellphone.Text;
acc.Telephone1 = tel.Text;
srv.AddObject(acc);
srv.SaveChanges();
alert.ForeColor = System.Drawing.Color.Green;
alert.Text = "با موفقیت ثبت شد";
}
}
and then when i run this code in my visual studio work correctly but when i run in iis i get this error
The Security Support Provider Interface (SSPI) negotiation failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The Security Support Provider Interface (SSPI) negotiation failed.]
System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(Byte[] incomingBlob, ChannelBinding channelbinding, ExtendedProtectionPolicy protectionPolicy) +6115112
System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState) +1325
System.ServiceModel.Security.IssuanceTokenProviderBase1.GetNextOutgoingMessage(Message incomingMessage, T negotiationState) +91
System.ServiceModel.Security.IssuanceTokenProviderBase1.DoNegotiation(TimeSpan timeout) +586
[SecurityNegotiationException: SOAP security negotiation with 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' for target 'http://crm.tadbirgaranbm.com/TadbirgaranMellat/XRMServices/2011/Organization.svc' failed. See inner exception for more details.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14489026
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +622
Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) +0
Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) +892
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) +254
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results) +43
[SaveChangesException: An error occured while processing this request.]
Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions options) +1791
crm.Reg.submit_Click(Object sender, EventArgs e) +790
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
this error occurs due to the time zone as the server is hosted on some other region which has a different time zone then the local timezone where the web application is running.
to solve this problem server have to manage the offset of every timezone and the simplest way to do it tom manage the time in UTC format. to learn more about UTC click here

userprincipal.findbyidentity an operations error occurred

Okay so, I have been given the responsibility to migrate a website with multiple applications to another server. That migration went well (all applications working). However, the performance of that new server was sub par (whole other story). We decided to migrate it again. This time everything is working very well-- except one application.
It worked just fine on the first and second IIS servers, but is refusing to cooperate this time around.
I've mirrored all the config settings that I could find from the working server:
windows authentication enabled: check
Impersonation disabled: check
applicationpool settings match: check
I just don't know what I'm missing; why would it work on one server, but not the other.
An operations error occurred.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: An operations error occurred.
Source Error:
Line 9: Dim myUsername As String = Right(User.Identity.Name, Len(User.Identity.Name) - InStr(User.Identity.Name, "\"))
Line 10: Dim ctx = New PrincipalContext(ContextType.Domain)
Line 11: Dim myUser = UserPrincipal.FindByIdentity(ctx, myUsername)
Line 12: hfValid.Value = "false"
Line 13: For Each gp As GroupPrincipal In myUser.GetAuthorizationGroups
Source File: D:\mghnet1\isOnCall\Default.aspx.vb Line: 11
COMException (0x80072020): An operations error occurred
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +378142
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.PropertyValueCollection.PopulateList() +26
System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +49
System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +150
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1114
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +37
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +112
System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +31
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +14
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue) +73
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +28
_Default.Page_Load(Object sender, EventArgs e) in D:\mghnet1\isOnCall\Default.aspx.vb:11
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456
Please help, none of the other forum posts I've found have posted solutions that work for me.

ASP.NET Website failure - DataAccessLayer threw an exception

I have an ASP.NET 4.0 website hosted on GoDaddy that has a database. My site will not coming up. I think it's my database connection -
My connection string -
<connectionStrings>
<add name="Personal" connectionString=" Server=xyz.com; Database=xyzDb; User ID=xyzUser; Password=xyzPass; Trusted_Connection=false" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString=" Server=abc.com; Database=abcDb; User ID=abcUser; Password=abcPass; Trusted_Connection=false" providerName="System.Data.SqlClient" />
</connectionStrings>
The error from my page -
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.] FonyFacts02.DataAccessLayer..ctor() +74
FonyFacts02.DataAccessLayer..cctor() +39
[TypeInitializationException: The type initializer for
'FonyFacts02.DataAccessLayer' threw an exception.]
FonyFacts02.DataAccessLayer.GetInstance() +0
FonyFacts02.FonyFacts..ctor() +34
FonyFacts02.Default.Page_Load(Object sender, EventArgs e) +99
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2207
Can anyone tell me if it is actually my connection string or something else?
The website is located at - http://www.fonyfacts.com/
Thanks
You shouldn't override the LocalSqlServer connection string name. It's defined in the machine.config file and for some reason has a special meaning making it one of the only 2 names you can't use (LocalMySqlServer being the other, also defined in machine.config). Pick any other name for your connection string.
Also, you're missing the Data Source attribute in the connection strings but I'm sure this was from your masking step.
I think you are passing some wrong values in connection string...
Server should be like
server=xpode.db.4563273.hostedresource.com
My site is also there ... and working with same connection. Please verify your db credentials
Thanks,
Rohit
xpode.com

Why does this ASP.NET stack trace report two exceptions at the same time?

On a Sharepoint site a user tries to repond once again to a survey he has already responded. IIS returns HTTP 500 and serves a page with the following error message:
Server Error in '/' Application.
--------------------------------------------------------------------------------
You are not allowed to respond again to this survey.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: You are not allowed to respond again to this survey.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x81020039): You are not allowed to respond again to this survey.]
Microsoft.SharePoint.Library.SPRequestInternalClass.IsVotingAllowed() +0
Microsoft.SharePoint.Library.SPRequest.IsVotingAllowed() +174
[SPException: You are not allowed to respond again to this survey.]
Microsoft.SharePoint.Library.SPRequest.IsVotingAllowed() +312
Microsoft.SharePoint.WebPartPages.ListFormWebPart.OnInit(EventArgs e) +955
System.Web.UI.Control.InitRecursive(Control namingContainer) +143
System.Web.UI.Control.AddedControl(Control control, Int32 index) +271
System.Web.UI.WebControls.WebParts.WebPartManagerControlCollection.AddWebPartHelper(WebPart webPart) +305
System.Web.UI.WebControls.WebParts.WebPartManagerControlCollection.AddWebPart(WebPart webPart) +1930590
System.Web.UI.WebControls.WebParts.WebPartManagerInternals.AddWebPart(WebPart webPart) +63
Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartWithRetry(WebPart webPart) +147
Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddDynamicWebPart(WebPart webPart) +122
Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts) +12053
Microsoft.SharePoint.WebPartPages.SPWebPartManager.LoadWebParts() +93
Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e) +690
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnInitComplete(EventArgs e) +11038910
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1674
There're two exceptions reported in there - System.Runtime.InteropServices.COMException and SPException.
How is that possible? What happened at ASP.NET level that two exceptions are reported at the same time?
One is an inner exception of the other.

Resources