Security :: Programatically Get User Info In A Usercontrol?
Jun 22, 2010In a web page,I can use the following code:
[Code]....
But that doens't work in a web user control. Am I missing a reference, or something?
In a web page,I can use the following code:
[Code]....
But that doens't work in a web user control. Am I missing a reference, or something?
I have identity impersonate = true in the Web.config file. I have integrated security = true in the DB connection string in the Web.config file.Before identity impersonate was true,users were able to access the DB through the web service account (seemingly).Now I get an error which says " Login failed for ... " because I am aware there is no specific account for that user in the permissions for that DB instance.I needed to set identity impersonate = true because the web service does not have access to the Active Directory,which I need to retrieve certain user information.
My question is,does identity impersonate = true override the integrated security and attempt to user the authenticated user's account to connect to the DB? Is there a simple way to prevent this in the Web.config itself?If not,would programatically impersonating the user within the Active Directory query functions and setting identity impersonate = false do the trick here?
I Have Question : Can I Edit Create User Wizard To Save Info To My Project Sql ? And Where Normal Create User Wizard Save Info Of Register?
View 5 RepliesUsing visual studio 2010.
Dragged and dropped a login control onto a blank content page. Set up my web.config (i'll include the code for that at the end). It seems to want to use a sql database to store the info. I just want to use the web.config since it's just a single user and a simple site. I thought I could just drag and drop the login control to a page and that would be the end of it (besides setting up the web.config).
Here's what i have in the config file
[Code]....
I am using the Login control on my login.aspx page to login to my /Members/Default.aspx page to display their current weight and their goal weight using the DetailsGrid. I have everything setup and I can log in and verify the user login name, but it only give one weight regardless of who logs in. Below is the SQL for the SQL Source on the DetailsGrid. I am new with this, Comparing the UserNames on aspnet_Users.UserName and memInfo.UserName should be able to extract that data, correct? Obviously I'm missing something. :)
SELECT memInfo.curWeight, memInfo.goalWeight FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN memInfo ON aspnet_Membership.UserId = memInfo.UserId AND aspnet_Users.UserName = memInfo.UserName
Is there an easy way to select a specific user that is already logged in and bind all the users info to a detailsview for edit and saving back to the tables?The tabels were generated in AWAT of VS 2010
View 1 RepliesIf I'm correct the membership functionality separates account and user (profile) data in two tables. Why not one table? What's the design priciple behind this?
View 5 RepliesI have read the post at http://forums.asp.net/t/1403132.aspx regarding login control. Is there a place to store the User logged-in ID (info) for later checking and use? I don't need to use the session object. I don't need the page to expire. I don't need the user to use a page saved in the favoites.
View 3 RepliesI like to build a components collection project so that I can use those components later on other projects. For example I created a UserControl called MyDataGrid.ascx
So suppose the projects layout are something like this:
--> IPGostarProject - Under namespace of IPGostar - contains components and lot's of user controls
--> SampleProject - here I want to use MyDataGrid.ascx UserControl from IPGostar namespace.
But as you know LoadControl function only takes virtual directory as it's parameter. So you can't load anything outside the SampleProject directory!
I have a webpage and on that page i load a usercontrol programatically
now i need to pass a value called fileName from webpage to the usercontrol
but filename is empty and when i put the flvControl.fileName = config.applicationURL & "/video/" & video.folder & "/" & video.videoFile
before flvControl = CType(LoadControl("media/flv.ascx"), mysite.flv) i get object reference error
code on my user control
[Code]....
I've 2 Textboxes (txtName, txtAge) & their validation controls in my UserControl &
1 Textbox(txtAddress) & submit button on my webform
If I click submit, I need to save Name, age from usercontrol & address from the webpage
Into Database (sqlserver/access/Oracle/xml)
My main question is How to access specific control info from UserControl
I've created a page to add users, using the CreateUserWizard, I use the Login Control to login.
I have setup the config file to use my SQL server, not express
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=xxxx.xxxx.xxxx.xxxx;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=xxxx;Password=xxxxxx" providerName="System.Data.SqlClient" />
I go to the create user page, add a user.
I can SEE the user on the database using Server Management Studio...
I go to signon and get "Your login attempt was not successful. Please try again."
I have not customized the login control in any way. (OR the createuserwizard)
HOW can I tell where the Login tool is going to get userid and password info?
How can I tell if it is not finding the user or the password does not match?
I try to get the user profile settings with this code. But all items in it are empty, in the database they are not empty. So there is going something wrong. First of oll how can i add a provider to the ProfileCommon ? Maybe i'm there then... the usrInfo is filled well...
MembershipUser usrInfo = Membership.Providers["MyMembershipProvider"].GetUser(UserName,false);
ProfileCommon prf = (ProfileCommon)Profile.GetProfile(UserName);
LitNaam.Text = prf.Voorletters.ToString() + " " + prf.Achternaam.ToString();
Is it possible to perform user management (store user info, login , logout etc) without using session or cookie?
View 3 RepliesI have the membership provider and the create user with tow steps, one of the steps contains a custom registration form, for each created user data will be in the database, and there is an account page shows the data that the new created user did insert during the registration process on the custom registration page,
the problem, when the user is created and logged into his account page, this account page shows only the information for the first created user, not the info on the logged in user , but the logged in user data still saved in database and not showing on his account page?
This is web.confg code:
<?xml version="1.0"?>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" AspCompat="True" %>
<%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[code]...
But still no results unfortunately.
In a User Control, I need to add a Div to the end of its parent's page. I've done this in a number of ASPX pages, where I put the code to generate the Div and its contents in the page's PreRender event handler, and it works fine. But when I try to do the same thing in the PreRender event handler for the User Control, I get the following error:
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.How do I accomplish this in a User Control?
I am a senior developer in an ISP company.
We developed a software which we want to require it for all ours users to have installed on there PCs before getting internet from us.
We built our own proxy server, and we are forcing all our users to view a aspx webpage before surfing the internet.
Now, we want this aspx webpage to check the PC if it have our software installed or not, and the mechanism will deny them to surf internet before install the software on there PCs.
How can we get special info from there regystry or something like that to know this?
Example: like flash player or silverlight player, where the requested page check if the PC have the right plugin installed or not. if not, it redirect to the installation page, if yes, the flash or silverlight movie run.
i have an admin page that displays membership info, like email, usename, lastactivity....., i need to add the telephone number from profiling.
i use this to get current but i dont need current i need it for the user whos ID is i a query string
[code]....
I am trying to integrate my asp.net 4.0(non MVC) website with facebook. I want to retrive the authenticated user info.The samples listed in facebooksdk is based on MVC. i tried to implement it in my website, but getting errors. i am struck.If anyone implemented the facebook connect logic and retrieved the user information using facebook-c#-sdk, please help me how to do this.I tried the same using facebooktoolkit, and i am able to retrive the user info. but the toolkit is having issues with .net 4.0.
View 2 RepliesI'm using the CreateUserWizard and it's working great. I do have a "step2" that asks the newly created user their first name and last name. Seems simple enough, but I'm getting an error on the Profile.Save(): "This property cannot be set for anonymous users". I'm assuming this is due to the fact that I have DisableCreatedUser="true" for the CreateUserWizard, which is what I NEED to do. Does this mean that until we enable this user, they can't add these few columns? Since the site I am updating requires matching a newly registered user to an already existing "Artist" table, it's important that the administrators are given the first and last name of the user. The aspnet_User table doesn't have that, so I thought I'd give the profile a try.
View 3 RepliesI have my database connected into project. Its located on different server. When I am managing users via WSAT everything is ok, it saves users into database on the server and additionally in my local App_Data folder. But when it comes to creating roles it only works with local database, but not applying into database located on the serwer.
Isn't it strange anyway, that it saves data into local database when there is not connectionString for this? I can delete database from App_Data and after doing some action with users/roles it creates new one.
I'm trying to use a custom Principal (with custom Identity) for security. This all works fine for logging in, out etc. I am now trying to limit access to unauthorised users within my code as follows:
[Code]....
Again, all is fine there. Except I need some more complicated rules, something along the lines of "Allow Admins. Allow Buyers, provided they have the correct department ID and are allowed to see this customer's credentials". All of that information exists within a database.
i use formsauthentication for login. but i wanna register user logs logs table. i can access username page.user.identity.name, but how can use userid?
View 4 RepliesI'm building an ASP.NET MVC 2 site where I'm currently implementing an OpenID sign-up form. Unfortunately, I'm foreseeing a possible security bug/vulnerability inside my architecture.
Here's how I want OpenID login to work:
User requests /Account/Login, Controller sends back OpenIDLogin View. User enters their OpenID into the View, then OpenID authorization takes place, and finally the OpenID is returned to the Controller.The Controller checks whether the OpenID is currently in use by a user in the system or not. If it is, the user is logged in to that account. If not, the registration process begins.
And now, the OpenID registration process:
The OpenID identifier, as well as any other information provided by the OpenID provider (such as email address or name), is put into my custom ViewModel and sent to my OpenIDRegistrationForm View.The RegistrationForm View stores the OpenID in a hidden field to make sure that it gets sent back to the Controller.The user fills in the RegistrationForm View and sends it back to the Controller.The Controller creates the user account and puts the OpenID into the database.
The bug that I see within my architecture is that a user could modify the hidden value in the RegistrationForm View. Thus, they could spoof their OpenID! I will make sure to add another round of checking to the final Registration Controller Action to make sure that the OpenID that is provided doesn't exist yet, but there is still a possibility for spoofing. Can my architecture be improved somehow? I don't want this to end badly...
One solution I'm considering is encrypting the OpenID before I send it to the View and then decrypting it when it reaches the Controller. Should I try this?