Click here to Skip to main content
12,630,949 members (32,958 online)
   

ASP.NET

 
GeneralRe: jquery for asp.net sometimes work sometimes doesn't work Pin
Dhyanga19-Dec-12 18:50
memberDhyanga19-Dec-12 18:50 
AnswerRe: jquery for asp.net sometimes work sometimes doesn't work Pin
jkirkerx19-Dec-12 19:09
memberjkirkerx19-Dec-12 19:09 
QuestionOnly 1 use for admin? Pin
xnaLearner19-Dec-12 2:28
memberxnaLearner19-Dec-12 2:28 
QuestionHave userID in view, need userName posted Pin
xnaLearner19-Dec-12 1:41
memberxnaLearner19-Dec-12 1:41 
AnswerRe: Have userID in view, need userName posted Pin
Matt U.19-Dec-12 5:11
memberMatt U.19-Dec-12 5:11 
AnswerRe: Have userID in view, need userName posted Pin
CommDev20-Dec-12 23:55
memberCommDev20-Dec-12 23:55 
QuestionUnable to start program http://localhost:1837/default.aspx using VS 2008 in Windows XP IE 8 Pin
sr15919-Dec-12 1:08
membersr15919-Dec-12 1:08 
QuestionHow to access 'name' given when user registers Pin
xnaLearner18-Dec-12 23:52
memberxnaLearner18-Dec-12 23:52 
So I only want the logged in user to be allowed to book holidays for them selves. I think the easiest way to do this is to compare 'name' of logged in user againast 'name' in person table. So....

public ActionResult Create()
        {           
            string xx = (string)Session["usernameID"];
            int? currentPersonID = Convert.ToInt32(xx);
 
            string userNameComparedAgainstLoginName = // here is where i want to say 'name' of logged in user

            CreateModel model = new CreateModel();
            model.currentPersonID = currentPersonID.Value;
            model.PList4DD = db.People.ToList();   
           
 
            if (userNameComparedAgainstLoginName == model.userName)
            {
                ViewBag.Id = new SelectList(db.People, "Id", "Name");
                return View(model);
            }
            else
            {
                TempData["canOnlyBookHolidaysForYourself"] = "I'm afraid you can only book holidays for yourself";
                return RedirectToAction("Index");
            }
        } 
---------------------------------------

the name given when the user registers will be the same names used in the db.

So could someone tell me how I can access the logged in 'name'?

Thanks
AnswerRe: How to access 'name' given when user registers Pin
xnaLearner18-Dec-12 23:58
memberxnaLearner18-Dec-12 23:58 
Questionsequence contains no elements Pin
xnaLearner18-Dec-12 3:44
memberxnaLearner18-Dec-12 3:44 
AnswerRe: sequence contains no elements Pin
Matt U.18-Dec-12 8:23
memberMatt U.18-Dec-12 8:23 
GeneralRe: sequence contains no elements Pin
xnaLearner19-Dec-12 0:00
memberxnaLearner19-Dec-12 0:00 
GeneralRe: sequence contains no elements Pin
Matt U.19-Dec-12 2:47
memberMatt U.19-Dec-12 2:47 
Question[session] returns null Pin
xnaLearner18-Dec-12 0:20
memberxnaLearner18-Dec-12 0:20 
AnswerRe: [session] returns null Pin
Rahul Rajat Singh18-Dec-12 0:47
memberRahul Rajat Singh18-Dec-12 0:47 
GeneralRe: [session] returns null Pin
xnaLearner18-Dec-12 1:10
memberxnaLearner18-Dec-12 1:10 
GeneralRe: [session] returns null Pin
xnaLearner18-Dec-12 1:12
memberxnaLearner18-Dec-12 1:12 
SuggestionRe: [session] returns null Pin
Chandrabhan Sangale18-Dec-12 18:59
memberChandrabhan Sangale18-Dec-12 18:59 
QuestionMultilingual support for Web Application Pin
AB777118-Dec-12 0:18
memberAB777118-Dec-12 0:18 
AnswerRe: Multilingual support for Web Application Pin
Rahul Rajat Singh18-Dec-12 0:43
memberRahul Rajat Singh18-Dec-12 0:43 
GeneralRe: Multilingual support for Web Application Pin
AB777118-Dec-12 3:27
memberAB777118-Dec-12 3:27 
AnswerRe: Multilingual support for Web Application Pin
deflinek18-Dec-12 0:57
memberdeflinek18-Dec-12 0:57 
SuggestionRe: Multilingual support for Web Application Pin
Chandrabhan Sangale18-Dec-12 19:01
memberChandrabhan Sangale18-Dec-12 19:01 
Questiongoogle map Pin
cdpsource17-Dec-12 21:52
membercdpsource17-Dec-12 21:52 
AnswerRe: google map Pin
ryanb3118-Dec-12 5:55
memberryanb3118-Dec-12 5:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 8 Dec 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid