Updated:
This is a re-write from my original question (or lack of), the main problem I am having at the moment is that when mapping my Widget domain models to the correct ViewModel I am having to do it like this which is definetly not the right solution...
public ProfileWidgetViewModel MapFrom(ProfileWidget input, Account userAccount)
...
Hello all. I have read this post and I wanted to use ControllerExtensions.RedirectToAction method. But I have System.Security.VerificationException Which says: type argument '[MyController type]' violates the constraint of type parameter 'T'.
My controller is declared as follows:
public class ProductsSearchController : Controller
...
I have an xml file in a WCF application that describes dependencies. It is loaded when the service facade constructor runs and works great when testing the app alone. The way our separate web testing application is setup is an endpoint in a different (mvc) project - So the relative paths are different to the xml file that we need to load...
Hello .NET gurus,
My idea was to create my own HttpContext which will include some of the internal objects used in our app. So I thought I will simply create
public class FooHttpContextBase : HttpContextBase
{
public string Foo
{
get { return "Boo"; }
}
}
And then override HttpContext property:
public abstract c...
Hello,
I am trying to populate a couple text box fields in my MVC application. I have a text box that a user can enter an ID and then click search, and based on the ID input from the user, information should be brought back to populate First Name, Last Name text boxes on the same page.
The problem I am having is bringing back this d...
I have a method that sets up my linq data context. Before it returns the DC it calls a stored proc that sets up the CONTEXT_INFO value to identify the current user.
A trigger picks up any changes made and using this context data writes an audit record.
I noticed that my context data was in the audit table blank so I wrote a simple unit...
I'm at the "Handling Edit Errors" (page 67) in chapter 1 of the Professional ASP.NET MVC 1.0 book and I'm running into a problem.
The problem is that when I'm editing a dinner and I click save, it's not catching any of the form errors, even though I left the Title blank. Neither UpdateModel(dinner) or dinnerRepository.Save() throws an ...
I'm part of the way through implementing a native CAPTCHA (i.e. not reCaptcha) solution in my app. I've built it along the lines of Sanderson's book, Pro ASP.NET MVC Framework. It's built into a HtmlHelper class so I can call it in my view like
<%= Html.Captcha("nameOfGeneratedCaptchaIdField")%>
However, to use this I'll need a way ...
Will we need to support two different code bases once we migrate our web app to Azure if we want to keep the old deployment still up in Windows Server or can the same exact web app be run on both?
...
I'm still sadly a bit n00bish when it comes to .NET MVC. I have a navigation partial view being called from a MasterPage where I would like to get a list of data. This partial view is in the "Shared" folder, and thus does not have a controller. How do I get data to it so that it may render a list?
Thanks
More specifically, I want to do...
I dynamically change DOM on client-side to add some new input fields using JavaScript.
Can I obtain the data on the server-side without using Ajax? Just pushing send button and get this new data in my controller?
...
I need to create a user login/logout/Session expiry tracking page(ASP.Net)..
It is obvious that I can invoke my tracking page when user logs in and logs out..
How do I detect session expirey ?
...
What is the best way to match URL parameter spanning multiple "/" in ASP.NET MVC ?
Eg URL: http://example.com/controller/action/p1/p2/p3/p4
I want to pass just one parameter to the action method (above, it is "p1/p2/p3/p4"). Here, the parameter may have arbitrary number of subitems ( p1/.../pn ).
What is the best way to accomplish th...
How best to get an array(item=>value) pair as a GET / POST parameter?
In PHP, i can do this:
URL: http://localhost/test/testparam.php?a[one]=100&a[two]=200
this gets the parameter as:
Array
(
[a] => Array
(
[one] => 100
[two] => 200
)
)
Is there any way to accomplish the same in ASP.NE...
Using EditorFor( model lamda, "viewTemplateName"), my output is completely not as expected. This doesn't produce any errors, but it is rendering output without markup. What am I doing wrong?
The Output:
HarryTomRichard
The Expected Output (I need to figure out how to render the List [] indexes on id too but not to that problem ye...
My MVC application has a form with many fields. When I submit the empty form, some of the field values returned were ,, (two commas).
string value = form[key]; // value is ,,
I was expecting to see an empty string, not 2 commas.
...
In my ViewModels I use several DataAnnotations to validate the form data, there are usually 2-3 annotations per field.
For example a field for an email address might look like this:
[Required(ErrorMessage = "Please enter an email address.")]
[Email(ErrorMessage = "That is not a valid email address.")] // Custom
public string Email { ge...
The action I target needs https. I already have a filter in place that redirects to https if a request comes in via http, but I would prefer to send the request via https right from the start.
EDIT
There was an answer from Darin (updated now to something else ) where he asked why I call this first action by http anyway. He had a good p...
Can I use IDataError and service layer validation together?
I am using IDataError for my my model.
However, I need to check for a condition in my service layer. If the condition is not true I need to give the user a validation message so that user can input new values.
Is this possible? Anything I need to take care of when attempting ...
I'm using Visual Studio 2010 RC and MVC 2 projects appear in File | New Project, but not MVC 1. Can I target MVC 1 webapps?
...