I've recently started using the Areas functionality of the Preview2 and it was working ok until I needed to return a Model to the view.
Controller:
public ActionResult ForgotPassword()
{
return View(new PasswordViewModel());
}
View:
<%@ Import Namespace="Portal.Site.Areas.Logon.ViewModel"%>
<%@ Page Title="" Language="C#" Maste...
I have an ASP.NET MVC page with multiple file uploads. After a failed post, all the file upload boxes are blanked out. I don't want the user to need to reselect all the uploaded files. Is there a way I can preserve the values in these fields if other fields fail to validate on Post?
I could do the uploads via AJAX, but this would be ...
To allow users and site admins to view/add/edit/delete data in my application I decided on this route:
routes.MapRoute("ClientRoute",
"{account}/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" });
which results in routes like: mvcapp.net/1234/contact/add.
To keep users {except admins} f...
I have an MVC project in which I have a form with a submit button. I have added a jquery client-side handler that intercepts the form submit event. The javascript function calls the same MVC action that would have been called without the javascript.
$("form[action ='/List/CreateItem']").submit(
function() {
...
I have this code for the controller in "/Controllers/Cubo/FilterController.cs"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace Mkt.Web.Controllers.Cubo
{
public class FilterController : Controller
{
//
// GET: /Filter...
"Publish succeed" appears in the status bar...
I execute IE8 , the home page is ok.
but the links to other views gives "Erreur HTTP 404.0 - Not Found".
The controler redirection do not work.
Under VS2008 IDE the "build and run" works fine.
Some basic things omited?...
Thank you for your help.
...
Hi
I have this problem that my sites uses alot of ajax and when a user times out they still are on my page. Now say a user walks away for 10mins(the timeout is set 10mins) now the user is timed out but still on the page.
So they could do a "save" request but now all my action methods that the ajax requests go to have an asp.net mvc aut...
System.NullReferenceException: Object reference not set to an instance of an object.
Making the Sitemap.CurrentNode work in my code is oddly a problem.
I haven't figured out how to list code on STOF yet... so here is the code that will easily be displayed.
Title: "localhost/home.aspx/about"
Response.write(SiteMap.Curren...
I'm trying to take away anonymous access to a single view of an MVC application.
I tried to did this by going to the directory (i.e. /views/private) and removing anonymous authentication. This didn't help.
What is the easiest way to do this?
...
Hi
I have a problem that when a user times out on my site they are still logged in. So they can still do an ajax request. If they do an ajax request on my site my asp.net mvc authorization tag will stop this.
The authorization normally then redirects the user back to the signin page if they fail authorization.
Now since this is an aja...
I am trying to unit test a controller action that uses UpdateModel but I am not correctly mocking the HttpContext. I keep getting the following exception:
System.InvalidOperationException: Previous method 'HttpRequestBase.get_Form();' requires a return value or an exception to throw.
To mock the HttpContext I am using some thing ...
My question is essentially the same as question 765054 on StackOverflow. I'm only asking it again because the accepted answer is incorrect (you can not access the session object in Application_BeginRequest).
Our use case is that we want to store the authenticated user's user object in the session. So in subsequent requests, we can c...
Hi
I have my own asp.net cookie here made like this
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(version,userName,DateTime.UtcNow,DateTime.UtcNow.AddMinutes(30),createPersistentCookie,userData,"/");
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie...
I'm not doing any fancy route patterns yet, just the basic controller, action, id style.
However, my actions never seem to be passed the id. When I stick a breakpoint in any one of my actions, the value of the id parameter is null. What gives?
Global.asax.cs:
public class MvcApplication : System.Web.HttpApplication
{
public static...
I have the following code:
<div id="comments">
<h2>
Comments</h2>
<div id="comment">
</div>
<% foreach (var comment in this.Model.Topic.TopicComments.OrderBy(tc => tc.CreatedDate).Reverse())
{ %>
<% this.Html.RenderPartial("TopicComment", comment); %>
<% } %>
<fieldset>
<% using (Ajax.B...
Forgive me if this is a stupid question. I am not very experienced with Web programming.
I am implementing the payment component of my .net mvc application. The component interacts with an external payment service. The payment service accepts http post request in the following form
http://somepaymentservice.com/pay.do?MerchantID=xxx&...
I have a method set up that uses jquery form for a file upload - after the upload I wanted to update a layer. Here is my code...
The problem is that the method is a JsonResult, and I can't figure out how to invoke the updating of another part of the page after it runs. Any suggestions?
<%@ Control Language="C#" Inherits="System.We...
How do I implement a simulated frameset in ASP.NET MVC without running afoul of browser differences?
If possible, I would like a header and two vertical panes. The header will be pinned to the top of the browser. The left pane will contain an index of some sort, and the right frame will contain content. Each of these panes can have i...
I am trying here to kinda merge 2 routes in 1 with asp.net mvc
These routes are :
http://www.example.com/e/1
and
http://www.example.com/e/1,name-of-the-stuff
Currently it is set as this in the Global.asax.cs :
routes.MapRoute(
"EventWithName",
"e/{id},{name}",
new { controller = "Event", action = "SingleEvent...
Hello
I have this loop that renders a schedule with checkboxes for each entry like this:
Monday Tuesday.....
08:00-09:00 [ ] [ ]...
10:00-11:00 [ ] [ ]...
Using this code in my view:
<% for (int i = 1; i < 10; i++)
{%>
<tr>
<td>
xx:00 - xx:00
</td>
<% for (int current...