asp.net-mvc

ASP.NET MVC - Appending data onto a file download

what is the best way to append data onto a file download? I figure that i can make my own class that implements InputStream and just consolidates two input streams (the file first, my additional data to append second.) but is there an existing view class that i can use to just return an InputStream or will i have to roll my own view cla...

Getting url from area + controller + action programmatically

Hello I have a custom login-actionfilter where that I'm trying to "upgrade" to mvc 2 that uses areas. private void RedirectToRoute(ActionExecutingContext context, object routeValues) { var rc = new RequestContext(context.HttpContext, context.RouteData); string url = RouteTable.Routes.GetVirtualPath(rc, ...

Global.asax, definition of routes

Hello!, I have a question about global.asax that I don't really understand. My scenario is that I have this route defined : routes.MapRoute( "Suspensions", "Suspension/{action}/{id}/{prev}", new { controller = "Suspension", action = "Index", id = "", prev = "" } ); T...

ASP.NET MVC truly log off with Forms Authentication

I have a logoff action on a controller as so: public ActionResult Logoff() { var x = Request.IsAuthenticated; var y = User.Identity.IsAuthenticated; FormsAuthentication.SignOut(); Session.Abandon(); var a = Request.IsAuthenticated; var b = User.Identity.IsAuthenticated; ...

Call asp.net mvc Html Helper within custom html helper with expression parameter

I am trying to write an html helper extension within the asp.net mvc framework. public static MvcHtmlString PlatformNumericTextBoxFor<TModel>(this HtmlHelper instance, TModel model, Expression<Func<TModel,double>> selector) where TModel : TableServiceEntity { var viewModel = new PlatformNumericTextBox(); var...

HttpPostAttribute not found?

Hi I just opened up a project I done in MVC a while back, fired right up I looked at in the browser and now all the sudden it just wont find the [HttpPost] & [HttpPostAttribute]. What can be the problem? errormessage The type or namespace name 'HttpPost' could not be found (are you missing a using directive or an assembly reference...

asp.net WebForm or MVC browser game

Hello, I would like to know is this platfoerm (MVC or WebForms) good technology of creating webBrowser based games and if so maybe You have got some tutorials, books, any resources which may be helpfull in beggining with such things. thanks for help, bye ...

Allowing the specific format of email address in MVC input

Hi I have a page in MVC where i want to take the email adddress as the input which can be of format like:"Jone Davi" <[email protected]>, "Ben Miller" <[email protected]>, "Jane Ton" <[email protected]>, Then from this I want to parse the valid emailaddress.But on click of the submit button getting error message" A potentially dangerous Reques...

Is a full list returned first and then filtered when using linq to sql to filter data from a database or just the filtered list?

This is probably a very simple question that I am working through in an MVC project. Here's an example of what I am talking about. I have an rdml file linked to a database with a table called Users that has 500,000 rows. But I only want to find the Users who were entered on 5/7/2010. So let's say I do this in my UserRepository: from ...

Error: The creation delegate must not return null in Autofac?

In my project I am using Autofac. Previously it was working fine. Now I have added some new code in Autofac and it's giving me "The creation delegate must not return null " error. The changes that I have made are as follows builder.Register<Rep>(c => { /*Get Session and LoginId*/ ...

How can one convince a team to use a new technology (LinQ, MVC, etc )?

Obviously, it's easier to do with some developers, but I'm sure many of us are on teams that prefer the status quo. You know the type. You see some benefit in a piece of new technology and they prefer the tried and true methods. Try, for example, DBA/C# programmer the advantages of using LinQ ( not necessarily LinQ to SQL, just LinQ in...

show List of Roles in a dropdown box but except "Admin" role

hi, i am having a dropdown box showing list of roles, i used Roles.GetAllroles() for showin' all roles in dropdown box but i don't wanna show a role named "Admin" in the dropdown box. ...

Delete jqGrid rows client-side only and sending deleted rows to ASP.NET MVC on form POST

The question is likely confusing and I apologize. I wasn't sure how best to word it. I am using jqGrid in a jQueryUI dialog which is inside a form. The user will use this form to create and edit Events. Upon editing, the user can click a button to open a dialog showing a grid of saved locations for the event. I want to give them the...

How do I prevent 'Publish Web' from overwriting config files?

When I publish my Asp.Net MVC website to the production server (via VS2008), the web.config & castle.xml files are overwritten. The content of these files is obviously different between my local dev environment and the production server. How do I prevent these files from being published? ...

How to access view model data in jquery?

In my html, I use Model.Subcontract.company How can I reference that data in my jQuery? ...

client side validation in ascx files (user controls) for asp.net mvc

hi, I have a logOn forn in ascx files and I render it as partial. How I can add a clinet side validation to this form, have any idea ? My below code does not work <%= Html.ValidationSummary(true, "Giriş başarısız oldu. Lütfen hataları düzeltip tekrar deneyin.") %> <% Html.EnableClientValidation(); %> <% using (Html.BeginForm...

How do you deploy MVC 2.0 to IIS6 running .Net 4.0??

Hi All, i have an MVC app and i'm trying to deploy it to a 2008 server running IIS6 with .Net 4 installed. The project is built with VS2010. Thanks! ...

Error messages for model validation using data annotations

Given the follow classes: using System.ComponentModel.DataAnnotations; public class Book{ public Contact PrimaryContact{get; set;} public Contact SecondaryContact{get; set;} [Required(ErrorMessage="Book name is required")] public string Name{get; set;} } public class Contact{ [Required(ErrorMessage="Name is required")]...

What is good practice in .NET system architecture design concerning multiple models and aggregates

I'm designing a larger enterprise architecture and I'm in a doubt about how to separate the models and design those. There are several points I'd like suggestions for: - models to define - way to define models Currently my idea is to define: Core (domain) model Repositories to get data to that domain model from a database or other sto...

Check model's ModelState in FileStreamResult action in ASP.NET MVC

I have a page that a user selects what he wants to download, the submit button posts the form to public FileStreamResult GetFiles(FileSelectionModel model) { //zips files into one zip return File(); } However, what if the model wasn't in a valid state? How do I check it? It wouldn't let me return View() or return RedirectToActi...