I'm trying to convert an existing asp1.1/dnn2.0 to asp2.0/dnn4.x... it's some code that when logged in a user can become another user (ie home office associate can log in as a customer and see the site the way the customer would see it).
I'm lost. Here's my error
System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'Lynne' to data type int. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at System.Data.SqlClient.SqlDataReader.Read() at System.Data.SqlClient.SqlCommand.CompleteExecuteScalar(SqlDataReader ds, Boolean returnSqlValue) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at DotNetNuke.BecomeaUser.IDCheck() at DotNetNuke.BecomeaUser.Page_Load(Object sender, EventArgs e)
I tried implementing you GetCurrentUserInfo()
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load' Obtain PortalSettings from Current Context
Try
DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()
'Dim _portalSettings As ProviderSettings = CType(Context.Items("PortalSettings"), ProviderSettings)
IDCheck()
' Log User Off from Cookie Authentication System
Dim vUserId As String
' Dim vPass As String
If (Request.Params("Agentid") <> "") Then
vUserId = Request.Params(
Session(
Response.Cookies(
"Agentid")"pRet") = vAgentid"Sub").Value = "555555555"
Response.Cookies(
"Sub").Path = "/"
Else
vUserId = Session(
Session(
"pRet").ToString"pRet") = ""
End If
Dim objSecurity As New Security.PortalSecurityDim blnLogin As Boolean = True
If blnLogin Then
' Attempt to Validate User Credentials
Dim userId As String = vUserId 'objSecurity.UserLogin(vUserId, vPass, 0, 0, 0, 0)
If userId >= 0 Then
FormsAuthentication.SignOut()
' expire cookies
Response.Cookies(
"portalid").Value = Nothing
Response.Cookies(
"portalid").Path = "/"
Response.Cookies(
Response.Cookies(
"portalid").Expires = DateTime.Now.AddYears(-30)"portalroles").Value = Nothing
Response.Cookies(
"portalroles").Path = "/"
Response.Cookies(
Response.Cookies(
"portalroles").Expires = DateTime.Now.AddYears(-30)"Sub").Value = Nothing
Response.Cookies(
"Sub").Path = "/"
Response.Cookies(
FormsAuthentication.SetAuthCookie(Convert.ToString(userId),
Response.Redirect(
"Sub").Expires = DateTime.Now.AddYears(-30)False)"~/" & "tabid/36/Default.aspx")Else
Response.Write(
"This User is not yet created to be a Web User.2")End If
End If
Response.Write(ex.ToString)
Catch ex As ExceptionEnd Try
End Sub
I'm not having much luck searching so I'm asking in this thread. PLEASE... even a search suggestion would help.