I may have the wrong "pattern" here, but I think it's a fair topic.
I have an ASP.Net MVC application in which it calls out to a WCF service to get back the ViewModels that will be rendered. (the reason it's using a WCF service is so that other small MVC apps may also call on for these ViewModels...only internally, it's not a publicly ...
Iv wrote an MetaDataProvider like the one below and am using it in conjunction with Editor templates. The DisplayName is working correctly, but for some reason the ShowForEdit value it not having any effect. Any ideas?
public class MyModelMetadataProvider : DataAnnotationsModelMetadataProvider
{
protected override ModelMetadata ...
I am getting:
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
when I try to use strongly-typed links int asp.net mvc.
My app is running under full-trust
...
I tried file system publish and ftp
I'm using VS2010 and .net 4.0
should i somehow include *.spark ext files to the MSBuild?
...
Whenever i return a list collection from a controller through Json. Im unable to get that list but if i just return a string from controller its working fine.
In View i have
<script type="text/javascript" language="javascript">
$(function () {
$('#btnFillList').click(function () {
alert("btnclick"...
If I create a new MVC web application project, build and run it the home page comes up as expected. However, if you change the project's Web Properties to use a "Virtual Path" that contains a dot (for example: "Version1.2"), it will fail to work ("The resource cannot be found.").
What options are there?
...
I'm dealing with an obese 3rd party webservice that returns about 3mb of data for a simple search results, about 50% of the data in that response is junk.
Would it make sense then to remap this data to my own result object and ditch the response so I'm storing 1-2 mb in memory for filtering and sorting rather than using the web-response...
Hello, we're facing a problem now. We have a pretty big page with a loooong inline script, which does all the work. We now want to obfuscate it and use it as a separate .js file. But the problem is that we have paths which are generated by Url helper (Url.Content()). So what is the best way to separate js file from the page and not using...
I need to access Active Directory to get information about groups that customers belong to. The project I have is an ASP.Net MVC application using C#. I've never programmed against Active Directory before, and need some advice on what the best way to get started is, what security model to use to access the information, and maybe point ...
I have a form which a user can fill in x times with the data they want too. The form is posted to the following Action.
[HttpPost]
public ActionResult Manage(ProductOptionModel DataToAdd)
{
if (!ModelState.IsValid)
{
return View(DataToAdd);
}
var Pr...
Can I configure MVC to directly look into a class library ("MyApp.Controllers" for example) instead of the foder Controllers?
...
I have a method that figures out what to do with a user after
protected override ActionResult RedirectFromReg1(IPrincipal u)
{
if something....
{
return RedirectToAction("LogIn", "Account");
}
return null;
}
The calling code then ret...
I have a viewmodel that has an int StateID field and a string StateName field like so:
public class DepartmentViewModel : BaseViewModel, IModelWithId
{
// only show in edit mode
public int StateId { get; set; }
// only show in display mode
public string StateName { get; set; }
}
I have a read only view that uses Displ...
Hi,
I'm having some weird behaviour when i use the following code inside the httapplication:
protected void Application_PostAuthenticateRequest
{
RouteData Data = RouteTable.Routes.GetRouteData(new HttpContextWrapper(Context));
string x = Data.GetRequiredString("xxx");
}
When that code is in place, the html pages are missing all ima...
Using ASP.NET 4.0 and MVC 2, I have added these suggested modifications:
In the web.config -
<httpRuntime requestValidationMode="2.0"/>
To the Controller -
<ValidateInput(False), AcceptVerbs(HttpVerbs.Post)>
To the View Page -
<%@ Page ValidateRequest="false" %>
I still receive the exception
A potentially dangerous...
I'm not sure if what I am try to do is possible but here goes.
I have a form with two drop down lists - category and subcategory. When a category is selected an AJAX call is made to get the list of subcategories. For demo purpose I've selected a category of 'Fruit' which shows all of the subcategories for this group.
<select id="catego...
Summary: DataAnnotation's automatic handling of an "int?" is making me rethink using them at all.
Maybe I'm missing something and an easy fix but I can't get DataAnnotations to cooperate. I have a public property with my own custom validation attribute:
[MustBeNumeric(ErrorMessage = "Must be a number")]
public int? Weight { get; set; }...
I have a site which has an area that requires authentication. Right now I use the roles attribute on all the controllers in that area, and I run a query to retrieve that users ID, and all their settings.
It seems like a code or design smell to me that I am retrieving the userid and settings each time a controller in that area loads up? ...
I have an animated gif as a progress indicator that I am using with the AjaxBeginForm. If I click the stop button on the browser while the gif is showing the animation will stop.
However when I click on the form again to submit the gif does not start animating again but the data was submitted.
So my question is,
How do I remove the g...
I have some viewdata that is generated by going through my repository to the database to grab some scheduling info. When the information is stored in the Viewdata, I noticed that the viewdata is enumerated. How could I access the enumerated items and generate a table/list based on the viewdata? Most of the information just needs to be sp...