Search

You searched for the word(s): userid:779716

Matching Posts

  • Impersonation in ASP.NET MVC different from ordinary ASP.NET?

    Hi, Is impersonation in ASP.NET MVC different from impersonation in ordinary ASP.NET? I have my web.config set to impersonation equals "false", I allow only authorized users access to my site and I use Windows authorization (via AD). In one of my static methods in a references assembly I create a WindowsImpersonationContext using the WindowsIdentity of the current user (HttpContext.Current.User). I then do what I need to do and WindowsImpersonationContext.Undo(). The code worked perfectly
    Posted to ASP.NET MVC (Forum) by ahoegh on 6/3/2009
  • Re: Html.DropDownList does not render SelectListItem.SelectedValue

    Strangely, my code works if I use TempData instead of ViewData. It must have something to do with the lifecycle of TempData versus ViewData. When I added ViewData["Name"] in the POST controller action and returned the view, the view still displayed the ViewData["Name"] from the GET controller action. In other words, the ViewData from the POST controller action did not replace the ViewData from the GET controller action even though they have the same key. Can anyone explain this
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/13/2009
  • Re: Html.DropDownList does not render SelectListItem.SelectedValue

    I am already using the same names for the ViewData and the DropDownList, so it makes no difference. My scenario is different in one aspect however. I am sending the ViewData back to the View as the result of a POST action. Originally the View is populated with a List<SelectListItem> in which no items are selected. Once the user selects an item, fills out the rest of the fields in the form and POST it, the form is re-displayed if it contains errors. Basically the POST-action in the Controller
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/13/2009
  • Html.DropDownList does not render SelectListItem.SelectedValue

    Hi all, Assuming that I have a list of SelectListItem's in which one item has SelectedValue = true, the following does not work: Html.DropDownList( "lala", ( List < SelectListItem >)ViewData[ "TheList" ], "Please choose an option" ) I have written a unit test and even been running the MVC app in debugging mode and I know, that a List<SelectedListItem> is stored in the ViewData. I also know that one of these items have a SelectedValue set to true. Is the
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/12/2009
  • How can I mock session state with Rhino Mocks?

    Hi, Can anyone tell me what the proper way to mock session state is with Rhino Mocks? I know that "google is my friend", but I cannot find what I am looking for. I need to be able to unit test a controller which relies on an object stored in session. Best regards,
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/9/2009
  • Re: Html.CheckBox + UpdateModel = always true boolean

    Ok, i've found the solution. It had nothing to do with MVC.
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/7/2009
  • Re: Html.CheckBox + UpdateModel = always true boolean

    Now i've tried this: <% = Html.RadioButton( "Enabled" , true , Model.Enabled ? true : false )%> <% = Html.RadioButton( "Enabled" , false , Model.Enabled ? false : true ) %> ... and I still just get a new persisted model with Enabled set to true. No matter what. Can UpdateModel just not handle boolean values?
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/7/2009
  • Re: Html.CheckBox + UpdateModel = always true boolean

    Seriously, what is wrong with this? View: <%= Html.CheckBox( "Enabled" , Model.Enabled) %> Controller: UpdateModel(OptionModel, Request.Form.AllKeys); Model class: private bool _Enabled; public bool Enabled { get { return _Enabled; } set { _Enabled = value ; } }
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/7/2009
  • Re: Html.CheckBox + UpdateModel = always true boolean

    I have a view with a checkbox like <%= Html.CheckBox(...) %>. In the corrosponding controller action, I create a new model/entity object of type x and in the next line, I do an UpdateModel(x, Request.Form.AllKeys). In the entity/model class of type x, there is a boolean property with a name that matches the name of the checkbox. Unless I have misunderstood something, UpdateModel should look in the posted form data for the value of a field with the same name as the property in the class and
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/6/2009
  • Html.CheckBox + UpdateModel = always true boolean

    Hi all, I am using the Html.CheckBox helper in my view, to display some checkboxes that are "mapped" to boolean values in a class. When a user opens this new "Create" view, the values of the checkboxes are "mapped" to the boolean values of a new entity object. Because the entity object is new, the ceckboxes are displayed in the view as unchecked. The problem is that when I submit the form - letting the checkboxes remain unchecked - a new entity gets persisted with all
    Posted to ASP.NET MVC (Forum) by ahoegh on 3/6/2009
Page 1 of 3 (29 items) 1 2 3 Next >