Search

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

Matching Posts

  • Re: Access to "User.Identity" in Controller constructor

    The User property of Controller is not populated until the Initialize method is called which happens after the constructor is invoked, hence the NullReferenceException. Jeremy
    Posted to ASP.NET MVC (Forum) by JeremyS on 9/6/2009
  • Re: System.MissingMethodException: Cannot create an instance of an interface

    You're correct - the problem is that you cannot pass a complex type (like IQueryable) between the two controllers. Calling RedirectToAction is not the same as a method call - it isn't passing the school collection directly to the SchoolList action. Parameters passed with RedirectToAction are encoded into the URL (either as route parameters or querystring variables) so they are typically simple types that can easily be converted to a string (strings, ints, dates etc) When the SchoolList action
    Posted to ASP.NET MVC (Forum) by JeremyS on 9/6/2009
  • Re: Access to "User.Identity" in Controller constructor

    If you need to access it from the ctor, then I would suggest injecting it in the form of some sort of CurrentUserService. Perhaps something like this: public interface ICurrentUserSerivce { IPrincipal CurrentUser { get; set; } } public class DefaultCurrentUserSerivce : ICurrentUserService { public IPrincipal CurrentUser { get { return HttpContext.Current.User; } set { HttpContext.Current.User = value; } } } Then, assuming you're using some form of IoC container, you can simply take a dependency
    Posted to ASP.NET MVC (Forum) by JeremyS on 9/6/2009
  • Re: Modelstate cleared when redirecting - what to do?

    [quote user="MartinF"] But as i understand it i will have to declare the filter attribute on every single action (or class / controller) for it to work (copy from tempdata back to modelstate), as i redirect to the page/url which posts to the "SignIn" action, and it is possible to SignIn from anywhere on the website ? Or have i misunderstood ? [/quote] [quote user="Augi"] You are right. You have to declare filter attribute on every controller. But it's easy to do
    Posted to ASP.NET MVC (Forum) by JeremyS on 3/20/2009
  • Re: Modelstate cleared when redirecting - what to do?

    I added a 'ModelStateToTempData' filter to MvcContrib a while back that may do what you're looking for. When you call RedirectToAction the ModelState dictionary will be copied into tempdata and then when the next action is executed it will be copied *back* from TempData into ModelState. The code is available here.
    Posted to ASP.NET MVC (Forum) by JeremyS on 3/19/2009
  • Re: Best Way To Reference Style sheets and scripts

    You may also want to take a look at the HtmlHelper Extensions we have in MvcContrib. The Stylesheet method will automatically resolve CSS files located in ~/content/css and the ScriptInclude method will resolve files located in ~/scripts They can be used like this: <%= Html.Stylesheet("foo.css") %> <%= Html.ScriptInclude("bar.js") %>
    Posted to ASP.NET MVC (Forum) by JeremyS on 3/4/2009
  • Re: Upgrading From Beta to Rc 1 | Go to View... Add View...

    You need to ensure that your project has the correct ProjectTypeGuids. Open up your .csproj file in a plain text editor (or right click on the project in Visual Studio, select 'Unload Project' and then 'Edit Project') and find the <ProjectTypeGuids> element (which should be under the first PropertyGroup). The element should contain 3 guids like this: <ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b
    Posted to ASP.NET MVC (Forum) by JeremyS on 1/30/2009
  • Re: Ajax MVC RC 1.0

    [quote user="Augi"] Each action method must return some subclass of ActionResult [/quote] This isn't actually necessary - if you do not return an ActionResult then the ControllerActionInvoker will wrap the returned object (in this case a string) in a ContentResult. To answer the original poster, you need to reference two scripts that come with the sample project - MicrosoftAjax.js and MicrosoftMvcAjax.js. If you're using the default project template these are in the 'scripts'
    Posted to ASP.NET MVC (Forum) by JeremyS on 1/30/2009
  • Re: Changes in RC that broke my app

    Regarding ValidateRequest: You need to set the ValidateRequest property to false on your Controller.
    Posted to ASP.NET MVC (Forum) by JeremyS on 1/28/2009
  • Re: validateRequest appears to be kicking in in MVC RC1 despite settings

    ValidateRequest is controlled at the controller level. You need to set the ValidateRequest property on your controller to false. Jeremy
    Posted to ASP.NET MVC (Forum) by JeremyS on 1/28/2009
Page 1 of 10 (99 items) 1 2 3 4 5 Next > ... Last »