changes made from one user's webpart's page, effects all user's

 I am just doing this offline right now in Visual Web Developer Express 2008

I created the login in

once in the memberpage area, people can modify their webpart page.

 I created several users to test this out.  I loaded it in a browser.

When I make changes as logged in user "A" .  Then logout and login as user "B", user "B,s" webpart page has been changed to user "A".

This goes true for whomever I log in as.  It changes for everyone.

Is there something specific I need to do in order to get everyone's changes to be unique for them & not go across the board?

0
cinstress2
6/4/2008 6:36:52 PM
📁 asp.net.personalization
📃 3779 articles.
⭐ 0 followers.

💬 15 Replies
👁️‍🗨️ 1471 Views

What authentication mode you are using? Maybe you are using Window Authentication? 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/4/2008 7:30:43 PM

in my config it says

<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

 

in another spot

<authentication mode="Forms" />

 

 

0
cinstress2
6/4/2008 8:01:09 PM

Do you have this in your Web Config settings?

<webParts>
            <personalization defaultProvider="SqlPersonalizationProvider">
                <providers>
                    <add name="SqlPersonalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="SQLConnString" applicationName="/"/>
                </providers>
                <authorization>
                    <deny users="*" verbs="enterSharedScope"/>
                    <allow users="*" verbs="modifyState"/>
                </authorization>
            </personalization>
</webParts>

You may aslo refer here for more information

http://dotnetslackers.com/articles/aspnet/UsingWebPartsInASPNet20.aspx


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/4/2008 8:23:43 PM

hi

http://dotnetslackers.com/articles/aspnet/UsingWebPartsInASPNet20.aspx

uses Visual Studio. I'm using Visual Wed Developer 2008 Express.  But i'll try it anyway and see what happens

thanks 


 

 

0
cinstress2
6/4/2008 8:48:38 PM

cinstress2:

uses Visual Studio. I'm using Visual Wed Developer 2008 Express.  But i'll try it anyway and see what happens

I don't think if it matters.. Just try it..


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/5/2008 2:21:31 PM

 I figured out what exactly isn't working.

In my webpart I have some things like a calculator control and a calendar for example.  When users move those things from one webpart zone to another, the changes are saved to that unique user.

The problem is that I also created some other databases, like a to do list for example.

well when one user changes their list, it also changes the lists on the other user's page.

 

so I need to figure out how to have the other databases save the changes made by each user, but just to that particular user... not everyone

I did make sure that  the asp.net development servers are all open for each database (ie no red x is on them in the database explorer

0
cinstress2
6/5/2008 3:55:02 PM

I think that's because you are manipulating your To Do List data for All users and not for a specific users.. If you wanted to display informations there based on users credential then you need to INSERT and UPDATE the database WHERE user = @CurrentLoggedUser 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/5/2008 4:27:17 PM

thanks, here is the sqldatasource for the to do list

I've tried adding where user= 

I get an error.  I tried  searching for the correct format, but can't seem to get anywhere.  I am using Visual Web Developer 2008 Express, target framework= .net framework 3.5

in visual basic

 

Is there someplace in this code that I need to change?  If so what is the code to add that would equal the where user= advice you wrote above

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    DeleteCommand="DELETE FROM [ToDolistTable] WHERE [ID] = @ID"
    InsertCommand="INSERT INTO [ToDolistTable] ([Date], [Note]) VALUES (@Date, @Note)"
    SelectCommand="SELECT * FROM [ToDolistTable]"
    UpdateCommand="UPDATE [ToDolistTable] SET [Date] = @Date, [Note] = @Note WHERE [ID] = @ID">
    <DeleteParameters>
        <asp:Parameter Name="ID" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Note" Type="String" />
        <asp:Parameter Name="ID" Type="Int32" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Note" Type="String" />
    </InsertParameters>
</asp:SqlDataSource>

0
cinstress2
6/5/2008 5:15:01 PM

Fisrt.. does your To Do List table has a user fields? If there is then you can just simply write a sql statements like these below..

SELECT * FROM [ToDolistTable] WHERE userId = @user

DELETE FROM [ToDolistTable] WHERE [ID] = @ID AND userid = @user

INSERT INTO [ToDolistTable] ([userId],[Date], [Note]) VALUES (@user, @Date, @Note)

UPDATE [ToDolistTable] SET [Date] = @Date, [Note] = @Note WHERE [ID] = @ID" AND userId = @user

I your ToDoList Table doesn't have a UserId field then you should add it for you to make it work..



Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/5/2008 5:37:21 PM

I get an error that says

 

Must declare the scalar variable "@username".

how and where do I declare that?

(I used @username instead of @user... but neither work)

I thought maybe I could insert a loginName

but I still got the error

System.Data.SqlClient.SqlException: Must declare the scalar variable "@LoginName1".

 

0
cinstress2
6/5/2008 8:50:10 PM

you need to set it as a paramter

    <DeleteParameters>
        <asp:Parameter Name="ID" Type="Int32" />
        <asp:Parameter Name="username" Type="String" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Note" Type="String" />
        <asp:Parameter Name="ID" Type="Int32" />

        <asp:Parameter Name="username" Type="String" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Note" Type="String" />

        <asp:Parameter Name="username" Type="String" />
    </InsertParameters>

Just be sure that UserName exist in your Database to get referenced with 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/5/2008 9:04:50 PM

 I still get the same error

I think I need to do something in the datakeynames

 

 but I already have DataKeyNames="ID"

so I don't know how to do multiple

this is from the grid view 

 

0
cinstress2
6/5/2008 9:46:25 PM

Just separate it with a comma like below 

DataKeyNames="ID,username"


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/5/2008 10:17:19 PM

 I got everything to work

 

thanks 

0
cinstress2
6/6/2008 9:20:22 PM

cinstress2 :

 I got everything to work

Glad to hear that! :) 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
6/6/2008 9:23:14 PM
Reply: