Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony 5 posts 25 karma points
    Feb 21, 2011 @ 18:30
    Tony
    0

    How to expose current user info to .net user control?

    hello!

    i'm trying to understand the 'big picture' in order to develop my own vb.net modules. so far umbraco looks great!

    i've watched the videos and googled a bit but i still am not 100% clear on best practices for data access in my user control. Given: i'd like to use the 1 database that installs with umbraco. i think i can add any additional values related to myUserControl to the existing object model.

    should i be adding certain umbraco dlls into my user control web application to gain data access? which ones? are there any examples of how to access this type of data?

    for example, what if i wanted to make a boring user control that displayed the current logged in user's username?

    many thanks to anyone with a good answer!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 21, 2011 @ 22:11
    Jan Skovgaard
    0

    Hi Tony

    If I remember correctly you need to at least add a reference to the umbraco.dll and the businesslogic.dll since the full member api is in umbraco.cms.businesslogic.member according to my level 2 course notes :-)

    Hope this helps.

    /Jan

  • Tony 5 posts 25 karma points
    Feb 21, 2011 @ 22:54
    Tony
    0

    awesome thank you. i'm going to settle down tonight and poke around, but now that i've been reading more, i think i may be able to do what i want with a custom data type. this excellent article decribes the process: http://www.nibble.be/?p=97

    i'm thinking a custom data type is one where i can use existing controls/custom logic and write the data to some generic place in the database referenced by guid. is this a correct understanding of what a custom data type is?

    i'm sure i will have more questions later (like how to get that data back out... hahahaha).

    -cheers!

     

    *EDIT - ...and i see i'm already using the wrong terminology... "User" is internal privelaged backend users, "Member" is for everyone else. *

  • Brad Hunt 26 posts 57 karma points
    Feb 22, 2011 @ 04:02
    Brad Hunt
    0

    Tony-

    Regarding your big picture question of data access and user controls. You can take a traditional .NET approach and use code behind, ADO.NET etc and just add a custom database table in the main umbraco DB to hold your data. If you take this approach you can use whatever data layer you are comfortable with: ADO.NET, LINQ to SQL, Custom classes, etc. Also you will need an admin page in which to view this custom data, and it is pretty easy to add a page to the umbraco backend.

    Or you could create document types in umbraco that have properties that are roughly equivalent to fields in a database. Then you could create new instances of that doctype using the API and the data would show up in your content tree.

    Hope that helps a little.

    Brad

  • Tony 5 posts 25 karma points
    Feb 22, 2011 @ 07:42
    Tony
    0

    thanks brad. i just spent the evening installing it and playing around. ran into a bit of a snag... it didn't like being installed in virtual directory... had to create a website through iis. after watching a few videos on vimeo i feel like i have a better understanding of it than dotnetnuke. excellent!

Please Sign in or register to post replies

Write your reply to:

Draft