Exception raised when invoking MembershipUser.ResetPassword() using OracleMembershipProvider - oracle

In some cases, MembershipUser.ResetPassword() raises an exception. This only happens for some users, and it's not clear why. There are no inputs to the method, so it seems like a problem internal to Oracle's membership provider implementation.
The exception text: The provider returned an error that is not described by other MembershipCreateStatus enumeration values.
The traceback:
at Oracle.Web.Security.OracleMembershipProvider.ResetPassword(String username, String passwordAnswer)
at System.Web.Security.MembershipUser.ResetPassword(String passwordAnswer)
at System.Web.Security.MembershipUser.ResetPassword()
...
Any idea what could be happening here?

Today I were having the same issue.
Answer is very simple. User account is LOCKED. Execute MembershipUser.UnlockUser() before password reset.

Related

Application.Current.Properties - System.AggregateException

I'm trying to get some data from Application.Current.Properties storage. Unfortunately, any time I want to use this Dictionary, I see this error:
An exception of type 'System.AggregateException' occurred in mscorlib.ni.dll but was not handled in user code
Additional information: One or more errors occurred.
And in details I found this:
{"Error in line 1 position 206. Element 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value' contains data of the 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfstring' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to 'ArrayOfstring' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer."}
It seems like I tried to save some non-string data to Application.Current.Properties. Unfortunately I can't run .Clear() method to erease all data, bacause I receive this error any time I'm trying to access this property.
What should I do to make it work?
Well, as its name suggests AggregateException, is just a container for one or more exceptions which may be thrown when using PLINQ or TPL.
As such exceptions may be thrown on different threads and may also occur concurrently, the system automatically catches and rethrows them within an AggregateException wrapper to ensure that they all get reported in one place. The exceptions themselves are exposed via the InnerExceptions property.
You can catch an AggregateException and check which exceptions it actually contains with code such as the following:
try
{
// perform some parallel operation
}
catch (AggregateException aex)
{
string messages = "";
foreach(Exception ex in aex.InnerExceptions)
{
messages += ex.Message + "\r\n";
}
MessageBox.Show(messages);
}
So I suggest you do this to see what is causing the problem
Please, remove your app from your device, Settings - Applications- Uninstall, this works for me. The Auth Object was crash in debug mode.Clean and Rebuild can be Helpfull to.

Check if property exists in object

I spent a long time now trying to figure this myself with the help of other questions but failed so I REALLY need to ask this again
I have the following object in ruby
(...)
:follow_request_sent:
:notifications:
:coordinates:
:place:
:contributors:
:favorite_count: 0
:entities:
:hashtags:
- :text:
:indices:
(...)
This is object X. What I want to do is check if x.place exists. I've tried barely EVERYTHING. any, ?, include?, with [hash], defined?, (...) but it ALWAYS throws an error "undefined method" when trying to access the property, whether it exists or not. It NEVER works and I don't understand why. This is twitter API btw. Does anyone imagine why? Please do not point me to another answers because basically they all failed.
If you want to see if there is such a method:
x.respond_to?(:place)
If you want to see if there is an instance variable:
x.instance_variable_defined?(:#place)

Writing a negative test by using exception handling

Let us say I have a login method that's working swimmingly. It's used in quite a number of places and saves plenty of lines of retyped code. For all intents and purposes, it does not make sense to make this method any shorter.
Is it proper to write a negative test by using exception handling? For example, if I wanted to ensure that a disabled user is not able to log into the system, is it too awkward to write something like:
begin
login(username, password)
fail
rescue Exception
page.should have_text('Sorry, your account is disabled!')
end
If login actually succeeds, the test should fail. And if we reach the exception, we find our error message and the test passes.
I'm wondering if this is too "clever" and may cause confusion. What's the best way of handling a negative test case here?
You would be testing the expected behavior so there would be no rescuing within your specs. In this case, you would want to disable the account in a before caluse and then ensure the exception is raised when you attempt to perform an operation (login, etc.).
Testing anything for the generic Exception is also a bad idea - you want to be very specific about the expected exception as a different issue could cause your specs to pass.
The code would look something like
expect { login(username, password) }.to raise_error LoginException

Mongo::OperationFailure - need to login when using from_uri

My goal is to connect with my heroku/mongolab database but I keep getting this error:
Mongo::OperationFailure at /mongotest/a/b
: need to login
file: networking.rb
location: send_message_with_gle
line: 89
The code I'm using is:
client = Mongo::MongoClient.from_uri(ENV['MONGOLAB_URI'])
db = client.db('test')
testcoll = db['testcoll']
testcoll.insert({:'_id' => "def", :'test' => "woop de doop"})
testcoll.find()
ENV['MONGOLAB_URI']=mongodb://heroku_app########:password#ds0xxxxx.mongolab.com:xxxxx/heroku_app########
I know that the uri is correct and contains the username and password, so why the error? Also, the error occurs on the insert() line, not the line where I authenticate.
Welp, turns out the url connects me to the heroku_app######## database, but I'm then trying to access the database called test so obviously I'm not authenticated. Would have been nice Mongo had returned an error specifying that I had logged in but not to the right database. Oh well.
I hadn't paid enough attention to the format of the uri, which is
mongodb://username:password#host:port/database
The database part is... pretty important, it turns out.
(I actually found the answer to this while writing the test, but if this answer had existed it might have saved me an embarrassingly large amount of time, so I'm writing it again and answering it myself.)

Custom oracle exceptions through JDBC

In a stored procedure I have used to;
raise_application_error (-20010, 'My Message');
to raise a custom error in a certain situation. What I am trying to do is when I make my JDBC call from java, to be able to identify this error as not just being a SQLException so that I can handle it differently. I though I could identify it by the errorCode, but that seems to always be 17062 and not -20010.
Is there another way to do this, or am I missing something?
you should get 20010 as your errorCode. the ORA-17062 is an error for invalid ref cursors. Are you sure the procedure you are calling throws the custom error ?

Resources