asp.net-mvc

Trouble redirecting string[]

I have a form that posts several like named elements to an action like so: <%= Html.TextBox("foo") %> <%= Html.TextBox("foo") %> <%= Html.TextBox("foo") %> posts to and returns: public ActionResult GetValues(string[] foo) { //code return RedirectToAction("Results", new { foo = foo }) } the "Results" action then looks like ...

Authorize an entire security group to perform an Action in ASP.Net MVC

Hello, I'd like to authorize users to perform specific actions within my controllers. I've found the ASP.NET tutorial which explains how to allow individual users to perform specific actions but can this be extended to security groups? For example, would everyone belonging to the "domain\group" security group have access to the GetSec...

Google Checkout in ASP.Net MVC

I have a fairly simple ASP.Net site that uses google checkout (I have an imagebutton with the PostBackUrl set to the Google address passing values of hidden fields) which works fine. I've been moving this app to MVC and I'm not sure how to handle this. I thought about using jQuery form but I don't believe this would work in this situat...

What is the equivalent to Master Views from ASP.NET in PHP?

I'm used to working in ASP.NET / ASP.NET MVC and now for class I have to make a PHP website. What is the equivalent to Master Views from ASP.NET in the PHP world? Ideally I would like to be able to define a page layout with something like: Master.php <html> <head> <title>My WebSite</title> <?php headcontent?> ...

MVC routing is not handling one of my directories

I'm using ASP.NET MVC with IIS 7.0. I've got 404 errors hooked up fine through my Application_Error override. In addition to "Controllers", "Models", "Helpers" etc. I have a directory called 'Files' that I use to store user-uploaded files. When I go to http://www.mysite.com/files, instead of getting a 'Not Found' I get a default IIS 4...

Using ASP.Net MVC UI Helpers in a classic ASP.Net project

Hi guys Just wondering if anyone know if in general you can use the MVC UI helpers in a classic ASP.Net project. Obviously you would have to be mindful not to you the form helper, etc. But I have some helpers that I have built for MVC and wondering if there is anyway I can use them as is in my older project. I know I would need to re...

In ASP.NET MVC with Spark View Engine on form submisison error why am I getting a 404 resource not found?

My view: /User/EditUserName/2/me <viewdata model="EditUserNameViewData" /> <form action="~/User/EditUserName" method="post" class="span-15 last"> !{Html.TextBox("newUserName")} <Submit id='"chooseNewName"' value='"Choose new name"' /> </form> Controller actions: [AcceptVerbs(HttpVerbs.Get)] public ActionResult EditUserName(int id)...

How to clear fields after post back in asp.net mvc?

Hi I am wondering how do I clear fields after a postback in asp.net mvc? Like right now when validation errors occur the fields stay populated with whatever a user would entered. This is fine however, when no validation errors occur I want the all the fields to clear and a message to display. So right now I have the success displaying ...

Adding a script reference to the html head tag from a partial view

How do I inject a script tag such as <script src="somejsfile"></script> or <script type="text/javascript>some javascript</script> into the head tag of a page from a partial view? ...

MVC lose session state?

Hi All, Please forgive me for my poor English. This is driving me crazy. I'm writing an application in ASP.NET MVC. Basically I have some pages which require to use session state. But now the session state loses after the following code: ... Session["admin_ID"] = "aa27ec10-d9d4-43d9-96f6-7cfb0d5099ca"; ... After the following code, ...

How to check whether the current URL has subdomain name using c#?

I need to check whether the current URL has the subdomain name and if it has the subdomain, I want extract it from the URL. Could anyone konw how to do this in the C# in an ASP.NET MVC app. Thanks. ...

how to store an hashtable or object in cookie

How to store object or hashtable in cookies? I am trying to store multiple values in hastable/class to the cookie in my asp.net mvc (C#) application. How to do it? ...

multiple table insert ASP.net MVC

Hi i am having problem inserting data into multiple table from one view. First understand the scenario: I have a student table and a student name table. Name table contains Firstname, Middlename, Lastname. Student table contains a foreign key of name table Id. I made a data model by ADO.net. Now how can i pass both Student and Name data...

drop down list in MVC

Hello All, I am absolutely new to the MVC application.I want a dropdown list on my form I have done it this way "<%= Html.DropDownList("Categories", (IEnumerable<SelectListItem>)ViewData["Categories"])%>" I am sending the viewdata[Categories] from the controller class file. this way IList allCategories = _dropdownProvider.GetAllCate...

Dependency injection into custom ViewPage generates weird error

i'm trying to inject stuff into a custom ViewPage (ModelViewPage, from MvcContrib) public class ValidatedModelViewPage<T> : ModelViewPage<T> where T : class { public ValidatedModelViewPage(IEnumerable<IBehavior<IMemberElement>> elementBehaviors) : base(elementBehaviors.ToArray()) { } } and my Autofac registr...

Images not showing depending on the URL: with or without dash "/" in the end

Hello mates, This is really weird. The images of my website are not showing properly. If a add a slash in the end of the url, they show up, otherwise, they don't. Take a look: This is the link with dash in the end: http://jobbox.com.br/cocoonhealth/insurance/private-health-insurance/ To see the issue, delete the dash in the end…. the ...

db localization with ASP.NET MVC and Castle.ActiveRecord

I'm trying Castle.AR in an ASP.NET MVC 1 app. I want to store localized content on db. I'm thinking of creating a single table with int stringId, string locale, string text, and all other tables with int fields instead of strings. [ActiveRecord] public class LocalString : ActiveRecordBase<LocalString> { [PrimaryKey] public int ...

Execution Priority in custom Attributes in asp.net mvc

I have two custom attributes in my asp.net mvc(C#) application. [CustAttribute1()] [CustAttribute2()] When i use those attributes to my actions, which will get execute first? [CustAttribute1()] [CustAttribute2()] public ActionResult Index() { Can i use more than one custom attributes for my actions? If so, in the above Action, whic...

Issues with pagination in ASP.NET MVC

I am trying to implementation the same pagination that is used in the NerdDinner ASP.NET. I am receiving the following error in my view, whenever the pagination starts to kick in. "A route named 'Index' could not be found in the route collection." The error is happening on Line 64. Line 62: <% if (this.Model.HasNextPage)...

Receiving "Path 'PUT' is forbidden" for RESTful Web Service Built on ASP.Net MVC

We have a super RESTful web service running well on two dev machines and a test 2k3 server. We're trying to get the same service running on two other offsite dev boxes. Whenever those two new, offsite boxes attempt a PUT request to 'Sessions' Resource (i.e Controller) (on localhost), IIS returns : "Path 'PUT' is forbidden" We turned ...