C# - Display Original Sitecore Username Instead Of What's Currently Typed In?
Jan 24, 2011
I might be overlooking something obvious here, but is it possible to return a Sitecore user with the username in the capitalisation they used when registering?
At the moment the username will be displayed as whatever the user typed when they logged in, but I'd like to be able to get the original string.
I'm using User user = User.FromName(domainUser, false);
UPDATE: This is what I ended up with after Yan's excellent answer:
// get the MembershipUser object normally by name
var initialUser = Membership.GetUser(domainUser, false);
if (initialUser != null)
{
// get the same MembershipUser by Id - in this case it retuns username in correct case
initialUser = Membership.GetUser(initialUser.ProviderUserKey, false);
}
// get the Sitecore user from the username in correct case
Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName(initialUser.UserName, false);
View 1 Replies
Similar Messages:
Oct 12, 2012
I need to develop image gallery
Image saved in Folder called Images and image Name , Description saved in Database Table Images.
On Deafault.aspx
Thubnail images should display with out any change in Quality i.e by DataList Control
On Click of Thubnail images Fullview of image with width and height same as image width and height
Next, Previous, Close Buttons on Popup window
View 1 Replies
Apr 29, 2010
When user start typing in their username in textBox field, a dropdown list shows old data. How can I clear this?. It's a class room and many students logs in from the same pc everyday, I don't want the student to see his mates usernames.
View 2 Replies
Feb 23, 2010
So my question is more in relation to what people consider to be the best practice and why:
I've been dropping literals into pages and repeaters and binding them in code behind for a while. Is this considered bad practice?
ie:
ASPX Page:
<asp: Literal id="litTextToInsert" runat="Server" />
Code Behind:
litTextToInsert.Text = objData.MyText;
OR (repeater):
[code]....
I personally dont like doing this as i find it makes it harder for me to know if someone changed the field name, or mis typed it during development - the other way you won't know until the page loads.
With the strongly typed version if something changes in your DAL etc the build will break - letting me know I've messed up.
Why do so many people appear to use weakly typed code in ASP.Net (in examples, MVC, etc)?
Am i missing something?
View 2 Replies
Nov 25, 2010
Given the benefits of using strongly typed views to eliminate typed errors and the use of lambda expressions why would one use a dynamically typed view? When I use them I don't feel as safe as with strongly typed views. Am I missing something? Is there a special use for them?
View 2 Replies
Feb 9, 2011
how do i get the [Display(Name="Some Title")] DataAnnotations "Some Title" rendered in the List scaffold view's output?
I create a strongly typed list scaffold view for this class:
public class CompanyHoliday
{
[Key] [code]...
However i don't want "Date" and "Name" in the table header - i want "Datum" and "Feiertag Name" rendered there dynamically. The actual column header titles should come from the Display Dataannotation.
View 2 Replies
Jun 3, 2010
I want to display the username using a label that is logged in using the default login script that comes with asp. How can I do that? In visual basic it's "label.text = textbox1.text" or something like this.
View 10 Replies
Dec 2, 2010
I was not able to find the post. I am building an MVC app and on the master page I want to display the user that is logged into the workstation. This is just an internal app so we were just going to use
AD authentication. I am not sure how ISS will be configured on the anonymous or impersionate part so I did this line of code in the master page
<%=Environment.GetEnvironmentVariable("USERNAME") %>
Is this proper and the best way or should I look for a better way. I know this is generic but just curious.
View 2 Replies
Nov 15, 2010
How to Dispaly the username on all aspx pages....?
am thinking that by using "session object" we can able to do this...bt am not sure
Can any send the code or links
View 3 Replies
Oct 9, 2010
The LoginName control displays the Username. I would like to display the Full Name of the user logged in rather than the Username. Below is my code. I cannot seem to access the LoginName control in code behind. I am wondering if it because the control is in .
ASPX Page:
<asp:loginview id="HeadLoginView" runat="server" enableviewstate="false">
<AnonymousTemplate>
[ <a id="HeadLoginStatus" runat="server" href="login">Log In</a> ] [code]....
View 2 Replies
May 19, 2010
I have a website that uses master page. I want a pop up to display so that user has to enter valid user name/psw in order to see pages. There will be only one username/password so web.config will store that info.
how to display pop up and check username and password.
View 4 Replies
Feb 2, 2010
integrate AspDotNetStorefront and Sitecore? I've been trying for the past couple of days to come up with a way to get the two systems to play nicely together, but it doesn't seem feasible from what I can tell. A couple issues I've run across so far:
Authentication between the two (AspDotNetStorefront has its own implementation, Sitecore just uses/extends .NET Membership)The main DLL for AspDotNetStorefront is what pops up in the stack trace when I get yellow-screened, but that DLL is obfuscated so I can't figure out what the problem is.
we need to keep our existing AspDotNetStorefront application as an e-commerce backend and use Sitecore to do everything else. AspDotNetStorefront has a CMS as part of it, but it's really not an acceptable solution for anything but really basic content pages.
EDIT:
I've decided to break this whole thing down into the different problems that I am facing at the moment and solve each one as efficiently as I know how. I'll detail the ones I have here and then update when I run into new ones.
Problem 1: Authentication between the two systems.
This one isn't too bad actually if you're knowledgeable about forms authentication tickets, which I wasn't at the time but am learning quickly enough. As long as the two systems share the same encryption info, it's easy enough to pass information back and forth between them using cookies as stated below in the accepted answer. The other kicker is that I needed to set the CustomerGUID in the AspDotNetStorefront Customer table to be the user ID from the Sitecore user tables (standard ASP.NET membership). So far this approach seems to work pretty well (I'm still in the proof of concept stage at the moment.
Problem 2: Getting at the product data
This one was a little more troublesome. The aforementioned web service has a few issues I've had difficulty working around. However, since the databases are going to be on the same server, I simply decided that since all I really need is the price and ID I would go ahead and set the ProductGUID column of each product in the Storefront database to match the Sitecore item ID of the corresponding item in the Sitecore database. This way I just need a quick query to grab the ProductID and price information which is only used in a few places. Everything else is going to be housed in Sitecore.
If anyone has anything to add feel free, as far as I can tell from Google, no one has actually done this before, so I'm having a lot of trouble finding resources on this particular topic.
UPDATE:
The integration is in fact possible and our site has been up for a week and a half now with very few integration related problems. This isn't something I recommend doing really on a personal level, but it is in fact possible to pull off.
View 1 Replies
Jun 8, 2010
I want to display client system information like username,ipaddress. I get only the remote address.Let me know how to get the client system information.
View 6 Replies
May 7, 2015
I have created a web application with 5 forms using asp.net & vb.net.
The system got more than 250 web clients.
My problem is when second user logs in to the web system, the second user overrides first user's details.
I want to keep user details and display login information on each 5 forms.
View 1 Replies
Jun 17, 2010
The Faking User Roles document in SDN appears to give exactly what I need. I have a few "roles" that I have access to through stored procedure calls I don't control, read-only, via a CRM I don't have direct access to.
Unfortunately, I can't find the method AddRole, or even the class UserItem, by its present name. Does this functionality exist in Sitecore 6.2? If so, where is it?
View 4 Replies
Sep 14, 2010
I need a code for validating availability of username and display appropriate message to user if available / not available.
View 6 Replies
Apr 4, 2011
I'm adding support for multiple language to my site. I've found many places in my renderers that have hard-coded strings I'll need to address.
I seem to have a couple different options of fixing this... one would be to use the standard .NET approach and store strings in a resource file. I'm not liking this because my Sitecore translators can't get to that... and also because I don't think Sitecore sets the Culture by default? Which I believe is how ASP.NET knows which language to use from the resource file.
Another option would be to add fields for all these strings in my Sitecore templates so they are visible to translators in Content Editor. But this seems like a huge hassle... there are many, many places where I would have to update my templates solely to store UI element strings.
View 1 Replies
Jun 8, 2010
I'm trying to change the layout of the home item, but the whole layout section seems like it doesn't do anything. How do I change the layout of something?
View 1 Replies
Mar 8, 2011
I have a section on my website where I plan to add a lot of text-based content, and rather than display this all at once it would be nice if I could add paging on just these pages. If possible, I would like to put all of my content within one content item and have the paging work automatically, building a URL along the lines of http://example.org/articles/title?page=2 or similar.
I've stumbled across an article that mentions paging with Sitecore items and this seems rather close to what I require, although mine requires pagination on a single content item, rather than multiple items.
Is it possible to do this with a Sitecore content item?
[URL]
View 3 Replies
Oct 27, 2010
I'm getting some strange behaviour with viewstate being lost on postback for a .net application using Sitecore. I'm assuming it might be some config variable somewhere but I'm new to Sitecore and don't really know where to start looking.
UPDATE: Sitecore has now gotten back to us with an answer. We had recently added the dtSearch module, and AutomaticDataBind was set to true in the dtSearch.config which overrides the setting in the web config. We've now removed it and it works fine again.
I've made a mini test if that might help. It's two usercontrols on one page, both with a repeater. When updating the viewstate gets lost so even if I'm binding the updated repeater again the data for the other one will be lost.
Usercontrol 1:
<asp:Repeater runat="server" ID="Repeater1" OnItemDataBound="Repeater1_ItemBind">
<ItemTemplate>
<li>
<asp:Literal runat="server" ID="Literal1"></asp:Literal>[code]....
what might be going on? Let me know if I need to provide any more information. The most annoying thing is that it was working last week but I have no idea what has changed!
View 2 Replies
Jul 24, 2010
I'm trying to debug sitecore 6 asp.net code using visual studio 2008 (Windows server 2003 OS), concretely i am trying to get breakpoints to work. I tried setting the breakpoint and then on VS, debug-> attach to process.. -> IIS web server process, but nothing happens when i browse to a certain aspx where a breakpoint is located at the beginning of the Sitecore.Web.UI.WebControl.DoRender method
I tried setting on the website properties home directory->configuration->debugging and check both client-side and server-side debugging but nothing changes. Tried stopping the website, recycling the appPool and restarting, reataching the debugger and nothing happens
View 2 Replies
Jul 24, 2013
I am developing a chat application. What Ii need is... I have to display user name and status(iam taking an image).. It should be as in gtalk in a single row i have to get name and that image. I need like wat i have to take in view page like div/table and how can we bind them in jQuery..
View 1 Replies
Mar 4, 2011
I m very new in VS (ASP.NET) and using C# in code behind file. I want to define global variables to use in whole application. EXAMPLE
I want to save some information in LOGIN Page and display it in other pages line UserName or AccessRights etc.
Is there anyway to do this without using Cookies and Seassion ?
View 6 Replies
Dec 23, 2010
i'm currently having a nightmarish moment with Sitecore. Basically my issues are two-fold:
1) the first time i added a standard value item to a template, and added a layout setup to it, i was thrilled, since all my items from that template were showing the layout, however now, certain items are now showing no layout at all. I tried doing presentation->layout, reset several times, but to no avail.
2) i added a new sublayout to the standard value layout to another placeholder, did publish on the template (republish everything, publish subitems), then publish on the standard values item again, just in case (should not be needed), i click on all items from the template, and they show the updated layout with the new sublayout (should be good, right?) however, i browse, both live and with preview to the pages and i am still seeing the old layout without my new sublayout.
View 2 Replies
Mar 26, 2016
How do i apply hide or display on a button when UseName and Manager UserName is equall to false or true..This is the Table
SELECT TOP 1000 [Id]
,[UserName]
,[FriendUserName]
,[FollowStatus]
,[OutPutStatus]
,[SendDate]
FROM [HORNTIMEDATABASE].[dbo].[USERFollow]
[code]....
View 1 Replies