asp.net-mvc

How does RedirectToRoute affect SEO?

So I have my domain - www.mycatchyname.com, and its basically a single page site that has one purpose, so I've used RedirectToRoute on the root controller/action to go straight to www.mycatchyname.com/seo-keyword. So www.mycatchyname.com/seo-keyword is basically the homepage. How does Google see this? People searching for what my site i...

Calling the Session before any Controller Action is run in MVC

Hi, I have this authentication check in my global.asax file in the Session_OnStart() call: if (Session["Authenticated"] == null) { Response.Redirect("~/Login.aspx"); } This kind of session authentication is tightly coupled in all our web apps so I have to use it this way. This global.asax sits in an older ...

Random DataReader errors and thread-specific DataContext allowing for changing DataLoadOptions.

My .NET MVC project has reached the stage of testing with multiple users and I am getting seemingly random errors (from any screen in the site) relating to Linq2Sql DataReader issues, such as: 'Invalid attempt to call FieldCount when reader is closed.' and 'ExecuteReader requires an open and available Connection. The connection's current...

Using repository pattern in ASP.NET MVC with a SQL Server DB; how to mock repository so its unit testable without breaking OOD

I've been learning the ASP.NET MVC framework using the Apress book "Pro ASP.NET MVC Framework" by Steven Sanderson. To that end I have been trying out a few things on a project that I am not that familar with but are things that I thing I should be doing, namely: Using repository pattern to access my database and populate my domain/bus...

would i need antixss for report printing

Hi All, I have a report web page that allows you to export records shown to an excel file. I'm using AntiXss to display them on the screen but when a user opts to export to file and I go and get the records again from db will I need to use AntiXss to scrub for reporting purposes? Thanks, rod. ...

using MultiSelectList in ASP.NET MVC

I'm trying to create the edit form for book (with id 1), I want the selection list to select the existing author which retrieved from database. That book with id 1 has an author with id 1, but the HTML does not show selected author with id 1 for that book. I feel like there is something wrong with the argument ViewData["SelectedAuthors"...

Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Castle.Services.Transaction.ITransactionManager was found

Hi I am using Castle with the Nhibernate Integration Faclility I am running a few tests and they are failing with the error at Castle.MicroKernel.DefaultKernel.get_Item(Type service) at Castle.Facilities.NHibernateIntegration.DefaultSessionManager.ObtainCurrentTransaction() at Castle.Facilities.NHibernateIntegration.DefaultSessionManag...

Custom Redirection if Roles don't match

I have an Action result [Authorize(Roles = "Administrator,Paidmember")] public ActionResult ListPhotosbyModel(int? id) { } If the user once he is logged in is not in one of the roles he redirected to login screen but I want them redirected to a payment page where upon successful completion the user is added to paidmember. How do I...

Linq query in C# is not working as expected.

I have reproduced my problem in a console app. Following is the code. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LinqSample { class Program { static void Main(string[] args) { string query = "Maine, Maryland, Massachusetts, M"; var qu...

can i open views in an ajax modal popup?

Hi, I've been searching about using ajax modal popups in asp.net mvc, and i've only seen uses where there's a simple dialog box for input. Is it possible to open an entire view in an ajax popup? Is it possible to navigate multiple views in a single modal popup instance, as if they were going through a wizard? I haven't found any goo...

DotNetOpenId claimsResponse always Null

Hi, I found a several post about this topic. But I'm not able to find a solution. So. I set the ClaimRequest in the request: IAuthenticationRequest request = openid.CreateRequest( Identifier.Parse(id),Realm.AutoDetect); // Require some additional data request.AddExt...

ASP.NET MVC Form Submit with Link in stead of Button

Ok, I've wasted enough time trying things, time to ask for an aimed answer: I would like to have a simple login form (or any form for that matter), and be able to post it, not with a button, but with a link. So no input, but a. I've seen plenty of solutions for this type of question, and I've tried lots of different options, and every...

Entity Framework, Updating

I'm having a great deal of trouble with the Entity Framework (4.0) due to the pattern of 'adding' to a program. (Using ASP.NET MVC) The problem is that it feels like the entire structure of the Entity Framework is designed to 'build everything all at once'. It doesn't seem to lend itself to progressive development, because of all of the...

Overriding BindModel and BindProperty in CustomModelBinder, but BindProperty never hit.

Hi, I have a custom model binder with public override object BindModel(controllerContext, bindingContext) that checks session for an object and creates it if it isn't there, then returns the object. In that same model binder I have: protected override void BindProperty(controllerContext, bindingContext, propertyDescriptor) , and f...

Using jquery to generate a Slug from Title (on lost focus)

I want to use jquery to create a request to a controller action posting Title and getting back Slug. This needs to happen when user enters a title into a Title textbox on the form and then uses tab or enter to move to the next field. I do not want to convert title to slug in Javascript - I have a controller action set up to do it and it ...

Mock ParentActionViewContext MVC.Net

Hi, I can't find a solution to mock ControllerContext.ParentActionViewContext. here is the code of my controller [ChildActionOnly] public ViewResult Menu() { string controller = ControllerContext.ParentActionViewContext.RouteData.Values["controller"].ToString(); string action = ControllerContext.ParentActionViewContext.RouteData.Values...

How to debug RedirectToAction

I am trying to debug a problem wherein RedirectToAction appears to be working properly (i.e., the redirected-to Action is executed) but the specified View is never rendered on the client side and the url is not rewritten. My question is really where can I be looking to debug this? Here's the code: Form: <%using (Html.BeginForm("Save...

MVC: What's better, one large repository per db or one per business entity?

This time I have a more philosopical question. Most MVC tutorials/books seem to suggest to restrict the scope of one repository to one aspect of the model and set up multiple repositories to cover all model classes. (E.g.: ProjectRep, UserRep, ImageRep, all mapping onto the same db eventually.) I can see how that would make unittesti...

Double quotes into asp.net mvc url

how to handle double quotes in asp.net mvc url? ...

Error when Saving into SQL Server

So here is the error... An error occurred while saving the Panel. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int...