Click here to Skip to main content
       

ASP.NET

 
GeneralRe: jquery for asp.net sometimes work sometimes doesn't work PinmemberDhyanga19-Dec-12 17:50 
AnswerRe: jquery for asp.net sometimes work sometimes doesn't work Pinmemberjkirkerx19-Dec-12 18:09 
QuestionOnly 1 use for admin? PinmemberxnaLearner19-Dec-12 1:28 
QuestionHave userID in view, need userName posted PinmemberxnaLearner19-Dec-12 0:41 
AnswerRe: Have userID in view, need userName posted PinmemberMatt U.19-Dec-12 4:11 
AnswerRe: Have userID in view, need userName posted [modified] PinmemberCommDev20-Dec-12 22:55 
QuestionUnable to start program http://localhost:1837/default.aspx using VS 2008 in Windows XP IE 8 Pinmembersr15919-Dec-12 0:08 
QuestionHow to access 'name' given when user registers PinmemberxnaLearner18-Dec-12 22: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 PinmemberxnaLearner18-Dec-12 22:58 
Questionsequence contains no elements PinmemberxnaLearner18-Dec-12 2:44 
AnswerRe: sequence contains no elements PinmemberMatt U.18-Dec-12 7:23 
GeneralRe: sequence contains no elements PinmemberxnaLearner18-Dec-12 23:00 
GeneralRe: sequence contains no elements PinmemberMatt U.19-Dec-12 1:47 
Question[session] returns null PinmemberxnaLearner17-Dec-12 23:20 
AnswerRe: [session] returns null PinmemberRahul Rajat Singh17-Dec-12 23:47 
GeneralRe: [session] returns null PinmemberxnaLearner18-Dec-12 0:10 
GeneralRe: [session] returns null PinmemberxnaLearner18-Dec-12 0:12 
SuggestionRe: [session] returns null PinmemberChandrabhan Sangale18-Dec-12 17:59 
QuestionMultilingual support for Web Application PinmemberAB777117-Dec-12 23:18 
AnswerRe: Multilingual support for Web Application PinmemberRahul Rajat Singh17-Dec-12 23:43 
GeneralRe: Multilingual support for Web Application PinmemberAB777118-Dec-12 2:27 
AnswerRe: Multilingual support for Web Application Pinmemberdeflinek17-Dec-12 23:57 
SuggestionRe: Multilingual support for Web Application PinmemberChandrabhan Sangale18-Dec-12 18:01 
Questiongoogle map Pinmembercdpsource17-Dec-12 20:52 
AnswerRe: google map Pinmemberryanb3118-Dec-12 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web04 | 2.8.141029.1 | Last Updated 30 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid