asp.net-mvc

With a web app, how should I trigger jobs like, notifications, state changes, general repetivite tasks and checks

I am building a web application in asp.net MVC and am thinking how I can get certain conditional tests to happen regularly. Currently I am planning on having a page such as /utility/runJobs that will have a function in it that will test the whole site for dates meeting certain conditions etc.. I would then trigger this page from a serv...

How can I customize the AccountController/Register User action to add data to custom fields?

I think what I'm after doing is adding a couple of fields to aspnet_Users such as RealName and avatar for example, however, I want to insert values into these fields on user creation. I have changed the name of the action to Create as opposed to register as users are created via an Admin CP. I have assumed that this is the Action I nee...

Show popup on mouseover with link

I am showing the list of users with images as a grid in my asp.net mvc (C#) application. When i click on the user's image, i need to show a bubble popup (like, when we click on events cell in google calendar). The popup will contain some basic information of the user and an edit and delete option. How can i achieve it in asp.net MVC us...

ASP.NET MVC: Controller constructors

Hi, i'm just starting out with asp.net mvc. It's a long way before you can really get to a live project. At the moment i'm working to build a blog using the asp.net mvc unleashed book. However, i don't understand the 2 constructors in the BlogController (see question below) Thx... FIRST The BlogController has a private variable '_rep...

How to open a partial view by using jquery modal popup in asp.net MVC?

I have a partial view which I want to open by using JQuery Modal Popup. There is no problem while opening the view for a new record but I want to pass data to this partial view for edit. What is your best way to implement this? Thanks in advance. ...

ASP.NET MVC Content folder - URLs changed in source for CSS/images but not for JS?

If I have this in my Site.Master file: <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> and then go to View Source on page of my site (when deployed to actual server), it renders like this: <link href="Content/Site.css" rel="stylesheet" type="text/css" /> But if I have a JS file in the Scripts/ folder, it doe...

ASP.NET MVC custom IPrincipal injection.

Hi, I'm working on an application using ASP.NET MVC 1.0 and I'm trying to inject a custom IPrincipal object in to the HttpContext.Current.User object. With a traditional WebForms application I've used the Application_AuthenticateRequest event to do this as follows. protected void Application_AuthenticateRequest(object sender, EventAr...

Show reminder as floating popup/alert

I need to show a reminder as floating popup/alert in my asp.net mvc (C#) application. When the user has any information from the admin that should be notified at particular time, i need to show it as floating popup/alert in the user's screen. For ex.: When the admin sets an alert "Payment due last date is 15-Oct-2009" to notify the use...

Handling website access changes when using cookies

If I have a site that uses cookies for authorisation, so when the user returns they don't have to login again. If for some reason the site admin cancel this users account what is the best way to check for this. I don't want to have to hit the database every time the user visits a page to make sure their account is still live. So how shou...

LINQ vs. presentation model

Does LINQ substitute the presentation model? I read in the book "ASP.NET MVC in Action" about presentation models. I wonder why to build a presentation model?! For instance, projecting a domain object (entity) by creating a new class at runtime via LINQ is in my opinion more comfortable than creating dozens of presentation objects. ...

Determining which submit button was used to POST a form in asp.net MVC

Hello. I have a view in asp.net MVC that has two submit buttons. I would like to know which button was pressed. The buttons work GREAT so there is no issue there, I just need to do slightly different things depending on which button. I have checked the Request.Form[] collection and that doesn't contain anything. Here is my view code...

ASP.NET MVC Ajax expandable form using jquery

Hey everyone, My knowledge of jquery isn't very vast but what I'm trying to do is allow a user to click a button on a form to add more fields to the form to be submitted to the form itself... Something similar to how gmail used to handle email attachments by adding a bunch of input fields for each file, anyone have some pointers on how ...

What causes a query string when requesting jQuery? e.g. /jquery-1.3.2.min.js?_=12553...

I'm troubleshooting a jQuery problem which happens when the HTTP requests for a page load include this query string: GET /Scripts/jquery-1.3.2.min.js?_=1255309685187 Normally, the request has no query string and the response status code is 304: GET /Scripts/jquery-1.3.2.min.js However, every so often a query string is appended. ...

Strongly-typed views in ASP.NET MVC 2.0 Preview 2 no longer function

I had a functioning ASP.NET MVC 1.0 Project with strongly typed views. They no longer function after upgrading to ASP.NET MVC 2.0 Preview 2. The Model property now is an Object instead of the requested type. I have this: <%@ Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<TechHelp.Core.Models.Ticket>>" %> I g...

'+' causing bad request in URL's

I am Server.UrlEncode on some query string parameters and locally it is fine but on my server (IIS 7) it causing a Bad Request error. I am using ASP.Net MVC. If I manually change the + to a dash - the request works fine. This breaks: http://www.example.com/Glenn+Pang/234 This works: http://www.example.com/Glenn-Pang/234 Is this...

MVC: "The incoming request does not match any route." - with a default request

I am getting this error only SOMETIMES (apparently randomly, though I know there's really no such thing in computers). I'm working on an MVC (release 1) site in VS 2008. The machine is running Windows 7 with IIS 7, but this instance is running under the Webserver built into VS (Cassini?). When I do an F5 to start running it, I will some...

Dealing ASP.net Routes with n slashes using regex

I need to use a URL like this: http://mydomain.com/Box/Categ1/Categ2/Categ3/.../CategN/id1,id2,id3,...,idN Then I tried to create a new route this way... routes.MapRoute( "Box", "Box/{data}", new { controller = "Box", action = "Index"}, new { data = @"([a-zA-Z0-9-,]+/?)+" } ); But it just doesn't work. If I use any c...

ASP.NET MVC + modelstate and partial view

I have a partial view called LogOn where i basically copied the logon inputs into a control. I am using Html.RenderPartial to place the control in my Index.Html inside of an Ajax.BeginForm <div id="login_ajaxtarget"> <% using (Ajax.BeginForm("Logon", "Account", new AjaxOptions { UpdateTargetId = "login_ajaxtarget", HttpMethod = "Post...

Server.Execute() in ASP.NET MVC

Is there an equivalent to Server.Execute() in ASP.NET MVC? Apparently that only works with traditional webforms .aspx pages. Update: I need to grab the rendered HTML from a different action in the same controller to generate a PDF. Maybe there's a way to execute a View without outputting the html to the response stream? ...

In terms of performance, which is faster: Linq2SQL or Linq2Entities (in ASP.net MVC)

Comparing the two data models in an asp.net MVC app, which provides better performance, LINQ 2 SQL or LINQ 2 Entities. They don't always perform the same database operations when you use the same methods, or have the same LINQ methods for that matter.... ...