hi,
yesterday i posted a question regarding the Exception Handling technique, but i did'nt quite get a precise answer, partly because my question must not have been precise. So i will ask it more precisely.
There is a method in my BLL for authenticating user. If a user is authenticated it returns me the instance of the User class which i store in the session object for further references. the method looks something like this...
public static UsersEnt LoadUserInfo(string email)
{
SqlDataReader reader = null;
UsersEnt user = null;
using (ConnectionManager cm = new ConnectionManager())
{
SqlParameter[] parameters = new SqlParameter[1];
parameters[0] = new SqlParameter("@Email", email);
try
{
reader = SQLHelper.ExecuteReader(cm.Connection,
"sp_LoadUserInfo", parameters);
}
catch (SqlException ex)
{
//this gives me a error object
}
if (reader.Read())
user = new UsersDF(reader);
}
return user;
}
now my problem is suppose if the SP does not exist, then it will throw me an error or any other SQLException for that matter. Since this method is being called from my aspx.cs page i want to return some meaning full message as to what could have gone wrong so that the user understands that there was some problem and that he/she should retry logging-in again.
but i can't because the method returns an instance of the User class, so how can i return a message instead ??
i hope i made it clear !
thank you.