Anyone know why im getting this error with webmatrix? Server Error in '/dev' Application. Cannot implicitly convert type 'long' to 'int?'. An explicit conversion exists (are you missing a cast?) 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: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot implicitly convert type 'long' to 'int?'. An explicit conversion exists (are you missing a cast?) Source Error: Line 56: if (isValid) Line 57: { Line 58: if (WebSecurity.ResetPassword(passwordResetToken, newPassword)) { Line 59: disabledAttribute = @"disabled=""disabled"""; Line 60: isSuccess = true; Source File: e:\web\awwwebrowse\htdocs\dev\Account\PasswordReset.cshtml Line: 58 Stack Trace: [RuntimeBinderException: Cannot implicitly convert type 'long' to 'int?'. An explicit conversion exists (are you missing a cast?)] CallSite.Target(Closure , CallSite , Object ) +160 WebMatrix.WebData.SimpleMembershipProvider.ResetPasswordWithToken(String token, String newPassword) +324 WebMatrix.WebData.WebSecurity.ResetPassword(String passwordResetToken, String newPassword) +26 ASP._Page_Account_PasswordReset_cshtml.Execute() in e:\web\awwwebrowse\htdocs\dev\Account\PasswordReset.cshtml:58 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +209 System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +68 System.Web.WebPages.WebPage.ExecutePageHierarchy() +123 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78 System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContext context) +226 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
both are strings. the relative db columns i have are Password - nchar - 128 - allow nulls PasswordVerificationToken - nvarchar - 128 - allow nulls
I'm actually not sure what your program is doing, but the only suggestions I can offer is to check that token that WebMatrix is generating is of type string and maybe add some exception handling for null values.
possibly not supported on server? at http://msdn.microsoft.com/en-us/library/dd402827.aspx CallSite<T>.Target Field Platforms -------------------------------------------------------------------------------- Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2 The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
This is the error I'm focusing on: "Cannot implicitly convert type 'long' to 'int?'. An explicit conversion exists (are you missing a cast?)" which implies there is some data type mismatch somewhere. I was looking at the parameters, but maybe there is a type mismatch with the method? What data type does ResetPassword() return? It should match Boolean since it is encapsulated in the if statement. And then you mentioned db columns. Are the values in the db columns passed in as parameters? I don't think it has anything to do with the link you provided. Our Windows 2008/IIS7 servers support the .NET 4.0 Framework.
It does not return. I created the tables manually in the new db with webmatrix since i did not know how else to do it.
ok i think i figured this out. i just created a test site on my computer and all the keys are int not longs. the keys in the db that im getting an error with are longs. ill make the long to int key conversions and get back to you.
that was it. when i rebuilt the db i incorrectly made the id columns bigint instead of int. thanks for your time tasslehoff.
Great to hear! I'm glad you were able to figure it out. Oh, btw. The ResetPassword() method returns a Boolean type: http://msdn.microsoft.com/en-us/library/webmatrix.webdata.websecurity.resetpassword(v=vs.99).aspx