asp.net-mvc

ASP.net AppendHeader not working in ASP MVC

I'm having problems getting AppendHeader to work properly if I am also using an authorize filter. I'm using an actionfilter for my AJAX actions that applies Expires, Last-Modified, Cache-Control and Pragma (though while testing I have tried including it in the action method itself with no change in results). If I don't have an authorize...

Delaying LINQ to SQL Select Query Execution

I'm building an ASP.NET MVC site that uses LINQ to SQL. In my search method that has some required and some optional parameters, I want to build a LINQ query while testing for the existence of those optional parameters. Here's what I'm currently thinking: using(var db = new DBDataContext()) { IQueryable<Listing> ...

Multiple websites, Single sign-on design

Hi all, I have a question. A client I have been doing some work recently has a range of websites with different login mechanisms. He is looking to slowly migrate to a single sign-on mechanism for his websites (all written in asp.net mvc). I am looking at my options here, so here is a list of requirements: It has to be secure (duh) I...

Facebook IFrame Application issues for certain users

We have a strange issue with running an Facebook IFrame application (using MVC 2). When I run my app and log into Facebook, I get to the application just fine. But when my coworker does it, she gets the following error: API Error Code: 100 API Error Description: Invalid parameter Error Message: Requires valid next URL. Typically thi...

How to support leagcy urls(Web forms type) in asp.net mvc routing

We have recently shifted to asp.net mvc, but we still need to support some legacy urls. What is the best way to handle this situation. Is it Application_PreRequestHandlerExecute() event in global.asax, that I need to use or is there any better way? ...

How can I hit my database with an AJAX call using javascript?

I am pretty new at this stuff, so bear with me. I am using ASP.NET MVC. I have created an overlay to cover the page when someone clicks a button corresponding to a certain database entry. Because of this, ALL of my code for this functionality is in a .js file contained within my project. What I need to do is pull the info correspondin...

mvc2 host on iis6 : The incoming request does not match any route.

I have to host my project on iis6, I can not change iis setting on server. So, I modified global.asax like below. If I add a default.aspx and browse project I got error like : The incoming request does not match any route. if I dont add default aspx I got HTTP Error 403.14 have any idea? thanks public static void RegisterRoutes(Ro...

RESTful WCF Data Service Authentication

Hi, I'd like to implement a REST api to an existing ASP.NET MVC website. I've managed to set up WCF Data services so that I can browse my data, but now the question is how to handle authentication. Right now the data service is secured via the site's built in forms authentication, and that's ok when accessing the service from AJAX form...

Getting started with Soundex

My MVC site (sql08 back-end - nHibernate in the middle) asks for a company name when a user creates a new account. My business rules dictate that i accept whatever the user enters but into a field named CompanynameProvisional. Management needs to confirm that entry so we can enforce a One-to-Many relationship. (a single company can have ...

How to check for Model validation errors in asp.net mvc?

How to check from inside the View if there are any ModelState errors for specific key (key is the field key of the Model) ...

Asp.net mvc html melper

Hi there Ive got this function as a html helper which should write a javascript function onto the page, I then call this in the masterpage like this <%Html.RenderBaseUrlScript(); %> My problem is that the script never seems to be written to the page, I search in the source and cannot see it anywhere, I have tried moving this around ...

ideas on building a strongly typed class to manage URLS for asp.net mvc

I want a strongly typed url class that i will reference whenever I need a url for any links, redirecting, etc. I don't like: RedirectToActoin("Action", "Controller"); A site with 50+ views means any naming change is going to break allot of things. I also want a user frienly api so I can do: MyUrls.ControllnerName.ActionName How c...

Mixing Transaction Script pattern with DDD/CQRS

Hi all, Here is the situation, in order to support our legacy system, we need to insert to a table whenever a user logs in. This is basically an CRUD operation, so it doesn't really make sense to create repository/entity/command/event for this since this doesn't tie to any business rules at all. The only benefit to create a CQRS comman...

Proper way to build a data Repository in ASP.NET MVC

I'm working on using the Repository methodology in my App and I have a very fundamental question. When I build my Model, I have a Data.dbml file and then I'm putting my Repositories in the same folder with it.... IE: Data.dbml IUserRepository.cs UserRepository.cs My question is simple. Is it better to build the folder struc...

ASP.NET MVC with Crystal Report

I want to print report as pdf format by using crystal report in asp.net mvc but i don't know flow how to create report and print report in asp.net mvc , any one could help me for tutorial using crystal report in asp.net mvc ? ...

ASP.NET MVC - How do I implement validation when using Data Repositories? (Visual Basic)

I've built a UserRepository interface to communicate with my LINQ to SQL Data layer, but I'm trying to figure out how to implement validation. Here is what my AddUser subroutine looks like Public Sub AddUser(ByVal about As String, ByVal birthdate As DateTime, ByVal openid As String, ByVal regionid As Integer, ByVal website As String) I...

ASP.NET MVC NullReferenceException when inheriting from a Base Controller

I've got a base controller that I inherit all of my Controllers from. It's job is to basically set caching and error handling as well as check for mobile browsers. My UI works fine, but my Unit Tests are failing. Imports System.Web.Mvc <HandleError()> _ <CompressFilter()> _ <OutputCache(Duration:=30, VaryByParam:="id")> _ Public Clas...

ASP.NET MVC routing issue with Google Chrome client

My Silverlight 4 app is hosted in ASP.NET MVC 2 web application. It works fine when I browse with Internet Explorer 8. However Google Chrome (version 5) cannot find ASP.NET controllers. Specifically, the following ASP.NET controller works both with Chrome and IE. //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] public...

Why use TagBuilder instead of StringBuilder?

what's the difference in using tag builder and string builder to create a table in a htmlhelper class, or using the HtmlTable? aren't they generating the same thing?? ...

Difference between HtmlTable and TagBuilder("table")

Just wondering what the difference is between these two and what the benefit for one or the other of them would be when I build my table in my HtmlHelper HtmlTable table = new HtmlTable(); and: TagBuilder table = new TagBuilder("table"); This is more or less the same as this question, http://stackoverflow.com/questions/3043654/wh...