asp.net-mvc

How to pass special characters so ASP.NET MVC can handle correctly query string data?

Hello, I am using a route like this one: routes.MapRoute("Invoice-New-NewCustomer", "Invoice/New/Customer/New/{*name}", new { controller = "Customer", action = "NewInvoice" }, new { name = @"[^\.]*" }); There is an action which handles this route: ...

Should I use Membership for this unusual account system

My asp.net mvc site needs some kind of authorization but it is rather different than the usual concept of users and thus membership. It will be used more for preferences then for authentication actually. Accounts without any password should be possible (and will initially be the only type) and an account can also be used by multiple user...

Slow file delete file from asp.net mvc project

When I delete any file from an asp.net mvc project (project not in svn or any source control provider) it takes upto 60 seconds for the UI to become responsive again. CPU usage jumps to 80/90%. Has anyone else experienced this and know of any fix or solution? ...

How can I render a different controller's action from within a view?

I know that within a view I can render an action from the same controller using Html.RenderPartial. However, I need to render the output from an action under a different controller. What is the best way to do this? I would prefer to do this directly within the view, rather than doing it in the controller and saving the output to a ViewDa...

asp.net mvc - how access file upload in controller action

i try Request.Files, HttpContext.Request.Files but got no luck html form: <form name="" method="post" enctype="mulitipart/form-data"> <input type="file" name="file" /> </form> ...

Upload an image with wmd?

Is it possible with the wmd editor to add a button to let the user upload an image to the web server and place the corresponding img markdown in the textbox? If not, will another good inplace editor do it? Context: I'm using asp.net mvc, C# and I am a true beginner with javascript. ...

Routing Issues with MVC Preview 5 and IIS 5.1

Ok so I've spent a couple hours trying to resolve this issue and have had no leads so far, keep getting the same 404 error. What happens is the website picks up the Default.aspx page and displays it like it should. But the Home page has a clickable image where it routes to another view page. The image code is like so: <a href="<%= Url.A...

RedirectToAction Bug?

I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Step1(FormCollection form) { TempData["messageStatus"] = new Random().Next(1, 1000); return RedirectToAction("Step1"); } View: <%=TempData["messageStatus"]%> in first time in ...

What is the best way to allow for multiple buttons on an ASP.NET MVC form?

I have a feeling I'm being too "webforms" with this, but I'll ask anyway. I have a form in an ASP.NET MVC project that has some input fields and two buttons on it. One button is used to 'filter' one of the list boxes. The other is used to submit the form. My view looks something like this: <%using (Html.BeginForm()) {%> <%=Html...

maproute, querystings and mvc

I have two routes: routes.MapRoute( "FetchVenue", "venue/fetchlike/{q}", new { controller = "venue", action = "fetchlike" } ); routes.MapRoute( "venue", ...

Updating the view count of a webpage in a database

I have a database table called "Posts" which stores all the information regarding an article submission on a website. There is a column named "Views" which is a value that gets incremented each time that particular post gets viewed. The process is this: Get the record from the database Increment the current by one Save the changes t...

Setting ajax url for jQuery in JS file using ASP.NET MVC

When doing a Ajax call to an MVC action currently I have my javascript inside the View, not inside its own JS file. It is then very easy to do this: var xhr = $.ajax({ url: '<%= Url.Action("DisplayItem","Home") %>/' + el1.siblings("input:hidden").val(), data: { ajax: "Y" }, cache: false, success: function(response) ...

ASP.NET MVC: Problem setting the Authorize attribute Role from a variable, requires const

I am having a problem setting the Authorize attribute Role value from a variable. The error message says it requires a const variable. When I create a const type variable it works fine but I am trying to load the value from the Web.Config file or anything else that will allow the end user to set this. I'm using integrated Windows authe...

Expire Output Cache ASP.Net MVC

I am using the standard outputcache tag in my MVC app which works great but I need to force it to be dumped at certain times. How do I achieve this? The page that gets cached is built from a very simple route {Controller}/{PageName} - so most pages are something like this: /Pages/About-Us Here is the output cache tag that is at the to...

MVC RadioButton: Modelbinder passing incorrect hidden values?

For a Yes/No radio button group the following Html is rendered. The correct value of the response.text property is returned to the controller. However, the choiceID property of the hidden input is always "1" (the hidden value from first button). Also, the two instances of the selection values are returned to the Model List. ie. " no, Id...

Trouble with jQuery selector using ASP.NET MVC

Howdy. I'm new to both ASP.Net MVC and jQuery and what I'm trying to do is make a form that either adds a new RockBand or updates an existing RockBand based on if the rockbandid is an empty guid or not. I figured now is a good time to get rolling with jQuery. So the first step is to make a list of bands and put an edit link next to it...

JSON parameters auto. convert to lowercase when ajax request made to MVC action method?

Would anybody know why my parameter is being "converted" to lowercase when it hits my ASP.NET MVC controller action? I can only assume it is being converted as looking at data value just prior to the ajax request it is in correct casing, but then when debugging my action method within .NET during the ajax request and checking the incomi...

Newest Microsoft Chart and ASP.NET MVC

Recently ASP.NET developer launched its newest control, Charting control. (Microsoft Chart). Does this compatible with ASP.NET MVC, or its only compatible with ASP.NET WebForm ? ...

ASP.NET MVC Routing Question

I must be dense. After asking several questions on StackOverflow, I am still at a loss when it comes to grasping the new routing engine provided with ASP.NET MVC. I think I've narrowed down the problem to a very simple one, which, if solved, would probably allow me to solve the rest of my routing issues. So here it is: How would you ...

ASP.NET MVC Preserve Post Data After Authorize

Hi! I have an action handling a form post, but I want to make sure they are authenticated before the action. The problem is that the post data is lost because they user is redirected to the login page, and then back. [AcceptVerbs(HttpVerbs.Post)] [Authorize] public ActionResult AskQuestion(string question) { ......