CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 project conversion to latest (3.2.0.1) fails

Print topic Send  topic

Author Message
dragoon


Posts: 173
Posted: 07/27/2007, 2:14 AM

Hello everyone,

I have a project in .NET 2.0, environment: win2k3 SP1, sql 2005 SP1
I migrated the porject from 3.0.2.2 to 3.2.0.1 (actually the convert wizard recognized the project as a 3.0.2.2 version, although I was working before this in 3.1.0.1)

The project is not using forms authentication, I'm using Windows Integrated Authentication on IIS and therefore I'm using this variable Request.ServerVariables["LOGON_USER"] to get user identity (fair simple, because the project is used inside of a company, the roles are extracted from a sql database based on the LOGON_USER server variable)




Now, the problem after conversion is this:

Unable to cast object of type 'System.Security.Principal.WindowsIdentity' to type 'System.Web.Security.FormsIdentity'.

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.Security.Principal.WindowsIdentity' to type 'System.Web.Security.FormsIdentity'.

Source Error:
Line 32: 			if (DBUtility.UserId == null && Page.User.Identity.IsAuthenticated)   
Line 33: 			{  
Line 34: 				string password = ((FormsIdentity)Page.User.Identity).Ticket.UserData;   
Line 35: 				string login = ((FormsIdentity)Page.User.Identity).Ticket.Name;   
Line 36: 				bool IsPersistent = ((FormsIdentity)Page.User.Identity).Ticket.IsPersistent;  
Source File: c:\Inetpub\wwwroot\expenses\App_Code\components\CCPage.cs Line: 34

Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Security.Principal.WindowsIdentity' to type 'System.Web.Security.FormsIdentity'.]  
   Deconturi2006.Controls.CCPage.OnInit(EventArgs e) in c:\Inetpub\wwwroot\expenses\App_Code\components\CCPage.cs:34  
   Deconturi2006.Default.DefaultPage.OnInit(EventArgs e) in c:\Inetpub\wwwroot\expenses\Default.aspx.cs:329  
   System.Web.UI.Control.InitRecursive(Control namingContainer) +321  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692  

Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832


someone got any clue?
View profile  Send private message
dragoon


Posts: 173
Posted: 07/27/2007, 3:14 AM

it seems it's working ok, if I eliminate the follwing block from CCPage.cs:

		protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
		      
			if (DBUtility.UserId == null && Page.User.Identity.IsAuthenticated)   
			{  
				string password = ((FormsIdentity)Page.User.Identity).Ticket.UserData;   
				string login = ((FormsIdentity)Page.User.Identity).Ticket.Name;   
				bool IsPersistent = ((FormsIdentity)Page.User.Identity).Ticket.IsPersistent;  
				if (DBUtility.CheckUser(login, password))   
				{  
					Security.SecurityUtility.SetSecurityCookies(login, password, IsPersistent);  
			        if (IsPostBack)   
					{  
						Response.Redirect(".");  
			        }  
			    }   
				else   
				{  
			        Security.SecurityUtility.ClearSecurityCookies();  
			    }  
			}  
			  
		}  

somehow this is related to the new 'Remember Me' feature
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.