asp.net-mvc

Does Request.IsMvcAjaxRequest() method return true for requests originating from Ajax.ActionLink() click?

I have a controller action that is being executed by a link that was created using 'Ajax.ActionLink()' the problem is that I can't tell in my action that the request is an AJAX request because Request.IsMvcAjaxRequest() is always returning false. Does Request.IsMvcAjaxRequest() not work with Ajax.ActionLink() generated requests? Here i...

Is there a Request.IsMvcAjaxRequest() equivalent for jQuery?

I prefer to use jQuery with my ASP.NET MVC apps than the Microsoft Ajax library. I have been adding a parameter called "mode" to my actions, which I set in my ajax calls. If it is provided, I return a JsonViewResult. If it isn't supplied, I assume it was a standard Http post and I return a ViewResult. I'd like to be able to use somethin...

How can I use Html.ValidationSummary with Ajax.BeginForm?

I have an AJAX form that I am creating in my MVC project. If the form is submitted using normal browser function and a page refresh occurs I get validation information rendered in the form (the built in MVC validation based on ViewData.ModelState). Is there a similiar validation mechanism for AJAX forms? <% using (Ajax.BeginForm("Crea...

What's the point of ActionResult return type?

Hi, What is the point of an action returning ActionResult? ...

linq operators like in

HI, I have 3 tables: Clips, Books and relationships between ClipBook Problem is: i need get book that has bookID=4 with some clips i mean many-to-many in simple text sql it will be something like this: select * from Clips where clipID in (select clipID from ClipBook where bookID=4) Question is: How can i do this with Linq without o...

Do you use any custom ASP.NET MVC HtmlHelper extensions?

I'm interested in seeing what custom extensions other developers have created for the ASP.NET MVC HtmlHelper class. I think Microsoft got off to a great a start, but as usual, left a lot of open holes to fill! Looks like I am going to have to create some for rendering images, rendering action links as images, and so on. Thought ...

Castle MonoRail Routing with IIS 7?

I’m trying to make the routing module works with default action or controller, but it doesn’t. I always face with 404 page not found. Did I forget to do something? I really like routing in ASP.NET MVC feature, but I’m not sure I could do the same in MR. I’m using IIS7 with the build from castle trunk for .NET 3.5. ...

Asp.Net MVC vs Castle MonoRail

I've some experiences on build application with Asp.Net, but now MVC frameworks become more popular. I would like to try building new multilingual web application using with Asp.Net MVC or Castle MonoRail but I don't know which one is good for me. I don't like the web form view engine, but I like routing feature in Asp.Net MVC. Could a...

ASP.NET MVC Caching vary by authentication

Hello, I'm using ASP.NET Preview 5 (will upgrade soon to Beta) with LINQ2SQL on my recently launched tiny webapp. I was so proud of my work until Silverlight.net featured it on the first page and it started receiving a more than humble number of visitors. For some reason, users are sometimes getting "Specified cast invalid" thrown by ...

Translate a url to a route

Hi there! I feel like I'm re-inventing the wheel here, but I need to find a way of taking a URL from a catchall,and redirecting that to another route. The reason for this is because I need to do some things like adding session cookies for certain urls, and then pass them on to their relevant action. What's the best way of implementing...

How much computation is behind a HttpContext.Current call?

Is it expensive? I am developing an HtmlHelper that renders directly to Response.Output in order to save unnecesary string creation and I need to choose between: <% Validator.RenderClient(Response.Output); %> and <% Validator.RenderClient(); %> and get the textWriter from HttpContext.Current.Response ...

Ideas for XSRF Security implementation in ASP.NET MVC using Double Submitted Cookies

I've decided to attempt using the double submitted cookies technique to attempt to prevent XSRF attacks on the site I'm working on. So the way I have it written down here is, all actions that actually DO something other than GET information, will be posts. Gets will be...uh...GETs. Secondly, every form that posts will have the key/coo...

How do I specify attributes for a Html.TextBox helper while maintaing the value retreival from ViewData?

I am using the Html.TextBox helper to create textboxes. I want to set attributes on the textbox, which I understand is done using the following overload: Html.TextBox (string name, object value, object htmlAttributes) However, I want to maintain the functionality where the html helper automatically uses the value from either ViewData ...

Repository Pattern vs DAL

Are they the same thing? Just finished to watch Rob Connery's Storefront tutorial and they seem to be similar techinques. I mean, when I implement a DAL object I have the GetStuff, Add/Delete etc methods and I always write the interface first so that I can switch db later. Am I confusing things? ...

Multi-lingual websites with ASP.NET MVC

When building a multi-lingual website (with ASP.NET web forms), I'll use an HTTP module to rewrite the URLs to end up with something friendly (for humans & search engines) like: uk/products/product_category_one/sub_category_one/index.aspx uk/products/product_category_one/sub_category_one/widget_mk5.aspx es/productos/categoría_de_product...

MVC and jQuery validation, where to 'weave' the javascript and how to embed into master page?

Hi, If my header/footer are in the master page, and my .js files are referenced in the master page, how can I add jQuery validation on my login page? If there is an error detected, how will I modify the .js file to display the appropriate error message? ...

How do you implement paging in ASP.NET MVC?

Currently, I'm using a strategy found on many blog posts. Basically, the URL contains the page number (e.g. /Users/List/5 will give you the users on page 5 of your paged list of users). However, I'm not running into a situation where one page must list two separate paged lists. How do I go about doing this using ASP.NET MVC? Do I sim...

Practical Application of MVC || When to use, or not use MVC

I have seen the ASP.NET community buzzing about MVC. I know the basics of its origin, and that there are many sites (unless I am mistaken, stack overflow itself) based on ASP.NET MVC. From everything I have heard and read about MVC it seems to be the future of ASP.NET development. But since I don't usually dabble in .NET web developme...

Developing a simple photo ASP.NET/MVC application, how to do this?

I found this web site (photoblog) http://www.OneReaction.net/ and I am very curious how this is done: 1) From source code you don't see the image URL 2) How to overlay the copyright information on the image without changing the underlying photo? Ideas? Thanks! ...

Why won't Visual Studio 2008 create .mdf files with SQL Server 2008 Developer installed?

I'm trying some of the ASP.NET MVC tutorials and one of them has the following steps: Right-click on the "App_Data" folder, and choose "Add New item" Choose "SQL Server Database" under the "Data" category. However, once I do that, I get the following message from Visual Studio: Connections to SQL Server files (*.mdf) require SQL ...