asp.net mvc4 get user information when user reload page [closed] - asp.net-mvc

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I created custom login which use FormAuthentication. When user use login page, I get user information and save to session variable. If user check remember password, after user close page and reopen, authentication of user is authenticated, in this case, I can not get information of user.
How do I retrieve information of user in this case

Use cookies to store user id or something unique. Then get it and query database for example.

My solution:
After the user log, I create random TOKEN key, save it into DB to specific user, and add to Respone Cookie (the lifetime of the cookie, you can specify the desired).
Then, when user come again, I get cookie and check it value. If everything is correct, install the session variables.

Related

How to save the state of the application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working on a project in which I'm using oauth to authenticate with peoples stripe account. Part of this process is to send the user off to the stripe website, and then after they log in they are sent back to my application. The problem I'm having is that the stripe authentication is part of a set up process. So I'd like them to return to the place they were before they were sent away, i.e the same page and the state of the form they were in to be the same.
What would be the best way for me to do this, I've thought about saving the form state in the session, the problem with this is it requires a lot of awkward parsing, and can be quite brittle.
Any help would be greatly appreciated.
I'd create a database record before you go to Stripe keying with a GUID and then store the GUID in the session. Then when you come back you can load the database record and recreate whatever you need.
When redirecting the user to the OAuth form on Stripe's site, you can pass a state variable. Stripe will pass back the same variable when redirecting the user back to your return URI.

Can i use authorize/authentication for custom database [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Can i use authorization for custom database like i have created my own user table which have following attributes and at the same time can i use the authorization to check that if user is logged in then it checks that what is the role of user so he/she can view the page or not.
UserName
Role
ID etc.
I have tried Session["UserName"] and many things to manage the login system but it didn't worked
eg i have three views Managerpage Testerpage Developerpage each can view the related page according to roles Manager Tester and Developer.
Thank You in advance
please dnt block me just ask me if i cant explain my problem.
Going based on your picture. You should really provide more information if you are going to ask a question in the future.
SELECT UID
FROM dbo.User_Project
WHERE PID = '1';

Rails: How can I get a users profile picture through the Facebook API? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm using the Facebook API/omniauth so that users sign up through my site using their Facebook account, but I'm trying to figure out how I can set up their 'profile' area. I want their current Facebook picture to be their current picture on my site.
In your user model, in the from_omniauth method, you can add
user.avatar = auth.info.image
This line will obtain the image of the user and save in in the column avatar of type string, you should create that column in your user table first.

Rails: where to store something global is controlled by controller? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have Users in my app. Each of them has a Facebook profile (Koala is used for this).
So, I should store graph object anywhere. Next I should set facebook id for this graph. I do it from controller because user click "Sign in" and signs in.
Suppose User has friends: I want to get them by user.friends. This method should return facebook ids of user's friends. So, this method should use graph.
How to make all of this correct?
Hm... If I understood you correctly, you want to create and store global #graph object per User after he signs in. I think, we meet here with stateless property of HTTP protocol and one way to avoid it - using Rails session object. But this is wrong way in my mind.
Another way - create #graph every time after User signs in. And another way - using something middleware machinery, like Redis. You can store in Redis any information about User in string. For example, you can store in it set of User Facebook friends and get them any time you need.
But surely there is another way, I think )

Answering questions in surveymonkey with URL variables [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to assume with SurveyMonkey you can prepopulate answers in the survey via URL variables. For example, if I am sending out an email to my customers and one of the data points I want to have associated with my survey is email address.
Instead of the customer having to enter their email address I should be able to populate it for them.
IE surveymonkey.com/surveyname?email=blah#blah.com would fill in the Email fields with blah#blah.com
Is this possible? If not is there a reason? Does someone know of a survey platform that does allow this?
Thanks,
Chris
You can provide a custom variable with the survey by using the 'c' parameter, e.g.:
surveymonkey.com/s/survey?c=
This custom id is then stored on the respondent's details. You can put any text you like in there, including an email address.
However AFAIK you can't store other variables this way - just the custom variable.
Cheers,
Miles

Resources