asp.net-mvc

Is it possible to track JSONP calls to my site, via Google Analytics?

Since it's a lightweight JSONP callback to my site, I don't think there is a way to get standard Google Analytics tracking, unless I'm mistaken? Otherwise I'll have to track on my own, inside my action (asp.net MVC 2 site), correct? What sort of tracking would you do here? ...

ASP.net MVC AutoComplete Erroring?

I'm trying to get an autocomplete field firing in my asp.net mvc website. Basically the user types in their location and i go out to my db and pre-populate with country and postcodes that match. The problem im having is that when the view load an error throws saying "Microsoft JScript runtime error: Exception thrown and not caught". It ...

dynamically mapping roles to controllers in ASP.Net MVC

I am currently hard coding the authorized roles in the filter in my MVC applications like so: [Authorize(Roles = "Administrator,Manager")] I'd like to eventually have a way to map the roles to each controller, so that the site admin can handle assigning what roles can perform each set of actions. string roles = DoSomethingToGetAllowa...

ASP.NET MVC 2 caching problem

Hi, I'm writing an app and have come across caching problem which I cannot work out. I have a default Home controller for the site which checks whether the user is authenticated or not. If is not then LogOn View is displayed otherwise the client is redirected to another page. Along with the LogOn view, also a Check cookie is being sen...

JQuery stops working after an AJAX call (ASP.NET MVC)

Hi guys i know this is a known problem in ASP.NET MVC, basically what i have here is a photo gallery with categories (Red, Blue, Green). When i choose one category, say 'Red', it will do an ajax call and load the page with photos of red colored products. when i click one of the photos, i expect it to be enlarged (lightbox kinda effect)....

insert web page (like ticket booking) into another page

Hello, i need to integrate http://www.ebookers.com/ booking system into my web page, unfortunately i've never done that before. Would be glad to hear any advice how to accomplish this. Thank You ! ...

ASP.NET MVC: posting a certain object to the controller)

When I create a form to send data about new message: <% using (Html.BeginForm()) { %> <%= Html.TextAreaFor(m => m.Message.Text) %> <input type="submit" /> <% } %> I can't receive the message class in the controller: [HttpPost] public ActionResult NewMessage(Message message) // will not work, mes...

ASP.NET MVC - Illegal characters in path - redirect from Application_Error

In my application I generated few url which contained " (double quotes), unfortunately. I corrected the url's but google bot already indexed wrong urls. Now I get quite often following exception: System.ArgumentException: Illegal characters in path. The only one place I can catch the error is the Application_Error in the Global.asax - ...

ASP.Net MVC Jquery UI Autocomplete - list not showing up when I debug

I have implemented an autocomplete in my app for zip codes. I am debugging in Firebug and I see in my console that the action is performing and I get a list of zip codes in the list of results, but the actual list is not displaying when I debug. Here's the action in my Customers controller: //the autocomplete request sends a parameter...

ASP.NET MVC Partial View with different Model

In my Index view I have the usual Edit, Details and Delete links. I've made icons for them, and since I use them everywhere I placed them in a Partial View. Now, I do not have the feeling I'm doing it best practice here. So my question is: How to optimize it, or what should be different for best practice. The Partial View: <%@ Control...

Datetime format different on local machine compared to production machine

Hi, On one of my pages I display a datetime (from a database) and it is formatted correctly as a UK date time (dd-mm-yyyy) on my local machine. However when I deploy it to a server it reverts to American format (mm-dd-yyyy). Does anyone have any idea of when this might be happening? This might be outside the scope of stackoverflow but ...

Dynamic in MVC Views with similar but not the same classes as Model

Let's say we have an ASP.NET MVC View like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %> <%: Html.EditorFor(model => model.ServiceDate) %> <%: Html.ValidationMessageFor(model => model.ServiceDate, "*")%> and we have Model classes that are similar but not exactly the same, for instance Invoice an...

Passing multiple values to ASP.NET MVC controller

I want to pass multiple values to a controller. The controller looks like Page(string type, string keywords, string sortType) In a asp.net page, I have <%=Url.Action("Page", "Search", new { type = "new",keywords = keywords, sortType = "Date" }) %> But the values for type and sorType are passed as null inside the controller. Wha...

Programatically get controller address of ASP.NET MVC application

Say I want to send an email from my MVC application containing a link back to an item. So I want something in my controller like: string link = "www.mysite/mycontroller/itemdetails/23"; can I retrieve this programatically so it works on whatever server/configuration i happen stick it on? eg string link = GetCurrentActionRoute() + ...

Error when attempting to add MVC classes into an asp.net application

I have a large asp.net project to which I want to add MVC functionality. I have added the necessary references into the project (System.Web.Mvc (v 2.0), System.Web.Abstractions (v 3.5) and System.Web.Routing (v 3.5) and amended all the required files (Global.asax (routing requirements), the web.config, project (Controllers and View fold...

passing variable to view ASP MVC

I have 2 views, one to return all the locations belonging to a project, the other returns a json file containing the locations that used to show them on a google map. Listing the locations works like this as the id is sent with the actionlink, but how do I send the project ID to the Map view? public ActionResult GoogleMaps(int id) { ...

asp.net mvc session and membership authentication

Hi All, New to MVC, worked a lot with asp.net but never used the built in membership , authentication, authorization stuff before. I have 2 questions: In the asp.net days i would store the logged in user details (username, first & last name, email) in a session (using a custom class) and just checked that the session["UserDetails"] !...

asp.net MVC 2: in a create form, how to add new model relation entity with ajax request.

First of all , I use MVC 2 with Entity Framework 4. I Have 2 Entities. Customers and Emails There is a Relation 1 to many between Customer and Email. One customer ca have many Email. My question : In the Customer Creation page form, I have all the info related to the customer. ex: <%: Html.LabelFor(model = model.FirstName) %> <%: Ht...

how to get the id from /controller/action/id from within a view page?

From inside a viewpage, how can I reference the id from the url /controller/action/id without getting this data from the model? ...

Changing resources without recompiling project - ASP.NET MVC

I am looking for solution to a problem that I am having with resource files within ASP.NET MVC, I have tried a few different options in attempts to get this working but have so far been unsuccessful. The desired configuration would be one where I can make resource files available for editing after a deployment. The solution we are putti...