You are here:   Forum
Register   |  Login

 

Forum Notice

This Forum is ARCHIVE only
For LightSwitch questions,
please use the official forums at:

http://social.msdn.microsoft.com/forums/en-US/lightswitch/threads


Forums

Running external Application in an IFrame causes DotNetNuke to stop allowing users to log in
Last Post 13 Jul 2011 08:17 AM by admin. 7 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Michael WashingtonUser is Offline
Send Private Message
Posts:1110
Avatar

--
30 May 2011 04:40 PM
    If you follow the example described here:

    http://lightswitchhelpwebsite.com/B...yment.aspx


    Everything will work just fone for about 5 minutes. then you will find that users cannot log into the DotNetNuke website anymore.

    The reason is that when they log in, the DotNetNuke core stored procedure, UpdateUser, gets stuck in a loop until it times out.

    When I reproduce this on my test machine, I can go into SQL Enterprise Manager and the following query will run until you stop it:

    exec dbo.UpdateUser @UserID=2,@PortalID=0,@FirstName=N'Administrator',@LastName=N'Account',@Email=N'Webmaster@ADefwebserver.com',@DisplayName=N'Administrator Account',@UpdatePassword=0,@Authorised=1,@RefreshRoles=0,@LastIPAddress=N'::1',@IsDeleted=0,@LastModifiedByUserID=-1

    The question of course is why? I can only suspsct it is that perhaps something odd is happening because the MachineKey was copied into the remote site and some bad parameters are now being passed to the stored procedure?

    I am trying to investigate this, but any ideas are appreciated!
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    30 May 2011 04:55 PM
    First update. It's not the paramteters passed to the stored procedure. I have another DotNetNuke website where I am the Admin Account and User 2. When I log in, the "UpdateUser" stored procedure in that site is run with the exact same parameters and it runs fine.



    Now I am looking "inside" the stored procedure...



    ALTER PROCEDURE [dbo].[UpdateUser]

    @UserID int,

    @PortalID int,

    @FirstName nvarchar(50),

    @LastName nvarchar(50),

    @Email nvarchar(256),

    @DisplayName nvarchar(100),

    @UpdatePassword bit,

    @Authorised bit,

    @RefreshRoles bit,

    @LastIPAddress nvarchar(50),

    @IsDeleted bit,

    @LastModifiedByUserID int

    AS

    UPDATE dbo.Users

    SET

    FirstName = @FirstName,

    LastName = @LastName,

    Email = @Email,

    DisplayName = @DisplayName,

    UpdatePassword = @UpdatePassword,

    LastIPAddress = @LastIPAddress,

    LastModifiedByUserID = @LastModifiedByUserID,

    LastModifiedOnDate = getdate()

    WHERE UserId = @UserID



    IF @PortalID IS NULL

    BEGIN

    UPDATE dbo.Users

    SET

    IsDeleted = @IsDeleted

    WHERE UserId = @UserID

    END

    ELSE

    BEGIN

    UPDATE dbo.UserPortals

    SET

    Authorised = @Authorised,

    RefreshRoles = @RefreshRoles,

    IsDeleted = @IsDeleted

    WHERE UserId = @UserID

    AND PortalId = @PortalID

    END
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    30 May 2011 05:13 PM
    This query (this is the first part of the "UpdateUser" stored procedure) simply will not complete when I try to run it in SQL Enterprise manager:

    DECLARE @RC int
    DECLARE @UserID int
    DECLARE @PortalID int
    DECLARE @FirstName nvarchar(50)
    DECLARE @LastName nvarchar(50)
    DECLARE @Email nvarchar(256)
    DECLARE @DisplayName nvarchar(100)
    DECLARE @UpdatePassword bit
    DECLARE @Authorised bit
    DECLARE @RefreshRoles bit
    DECLARE @LastIPAddress nvarchar(50)
    DECLARE @IsDeleted bit
    DECLARE @LastModifiedByUserID int

    -- TODO: Set parameter values here.
    Set @UserID=2
    Set @PortalID=0
    Set @FirstName=N'Administrator'
    Set @LastName=N'Account'
    Set @Email=N'Webmaster@ADefwebserver.com'
    Set @DisplayName=N'Administrator Account'
    Set @UpdatePassword=0
    Set @Authorised=1
    Set @RefreshRoles=0
    Set @LastIPAddress=N'::1'
    Set @IsDeleted=0
    Set @LastModifiedByUserID=-1

    UPDATE dbo.Users
    SET
    FirstName = @FirstName,
    LastName = @LastName,
    Email = @Email,
    DisplayName = @DisplayName,
    UpdatePassword = @UpdatePassword,
    LastIPAddress = @LastIPAddress,
    LastModifiedByUserID = @LastModifiedByUserID,
    LastModifiedOnDate = getdate()
    WHERE UserId = @UserID


    What could cause this? I have to stop and re-start SQL Server to get everything back to normal
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    30 May 2011 05:24 PM
    Ok the Users table is simply locked when this happens. It is nothing special about the "UpdateUser" stored procedure. Also it is only the "Admin" record in the User table. I can edit any other row but that one.

    So the question is now, what is locking that row in the users table?
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    30 May 2011 07:55 PM
    Ok it appears I have tracked this down.

    I needed to determine if the current user is an Administrator or not in my external LightSwitch application. the problem is LightSwitch places locks on tables when you connect to external data sources.

    So when I connected to the DotNetNuke Users table, LightSwitch locks the rows it is using. Locking the DotNetNuke Users table is a no no. The thing that sucks is I also get this even if I am using a View (like vw_UserRoles)

    I can use others methods such as a web service to get the information I need.

    The good news is that this is only related to connecting to DotNetNuke as an external datasource NOT related to running LightSwitch in an IFrame with DotNetNuke.
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    04 Jun 2011 08:28 AM
    A final note on this. The answer is to use a WCF RIA Dataservice. This is what I am using in the Things For Sale example at: http://lightswitchhelpwebsite.com/D...rSale.aspx
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    SpartanUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:14
    Avatar

    --
    13 Jul 2011 08:08 AM
    One question I had is...how do you get your site to run so fast with DNN?  Is there any special configuration/hosting that you use?
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1110
    Avatar

    --
    13 Jul 2011 08:17 AM
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    You are not authorized to post a reply.


    Latest Microsoft Visual Studio LightSwitch Forum Threads That Have Answers

    Inactivity timeout
    11/26/2014 1:20 PM
    All,  I still didn't find a solution for the inactivity timout. After 5 minutes of inactivity, the authentication coockie is timed out. This results in the same problem for the lightswitch and the html client. I found a work around for the Silverlight client in creating a "hearbeat" timer that every 30 seconds does a simple query to the backend. I guess I can do something similar in the html client creating a time in the create event of the home page that does a similar simple query to the backend. this does not solve however the issue when I click the "remember me next time" in the logon page. Closing the browser and restarting again within 5 minutes works fine. I get automatically logged in, but waiting for more than 5 minutes before opening a new browser and navigating to the app doesn't automatically in. I guess the persistens authentication coockie is not valid anymore on the server. I thought the timout setting on the Forms authentication in the
    Read more...

    Hi Community,  Whats the best way of dealing with a featurerequest, where the screen is a editable screen, but where the user should be able to open up other screens?  The edit screen should show the navigational menu. regards Phero
    Read more...

    I've developed my first LightSwitch application. It's a web app. I developed it on my laptop. I want to host the app on my desktop Windows 8.1 Pro machine in my home network, as that's the closest thing I've got to a "server". I used Visual Studio 2013 to develop it, and it's using a SQL 2008 R2 Developer Edition database on the desktop. According to the MSDN article Deploying LightSwitch Applications I can publish it to my "server", so long as I've installed the Web Platform Installer 4.5, this is according to another MSDN article titled How to: Configure a Server to Host LightSwitch Applications. I tried doing that on my Windows 8.1 desktop, but when I got to the point of running the Web Platform Installer, it showed me that it was version 5.0; not 4.5 as the instructions said. Now, I'm guessing that is OK. I went to the Products tab and see that there isn't
    Read more...

    Hi, My lightswitch desktop application has stopped working. I am getting the following error when I try to start the application: "One or more active X controls could not be displayed because either: 1. Your current security settings prohibit running ActiveX controls on this page, or 2. You have blocked a publisher of one of the controls. " I have already tried the recommendation mentioned here Link My registry already has the right settings. Any help is highly appreciated. Regards, Sathya. 
    Read more...

    All, I have a LightSwitch project that successfully published to Azure at least 30 times. I am getting a publish error. (I've already done Dave's bankruptcy process.) Unfortunately, this is the 2nd time I've received this error. The first time was after installing vs2013 Update 3. That time, I resolved the matter by uninstalling update 3. This time, I need something in Update 4 which I've just installed but unfortunately, I am getting the following error when publishing to Azure: ----------------------------------------------------------------------- Error 1 The "CSPack" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files
    Read more...

    1234
    Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation