asp.net-mvc

Twitter Oauth with ASP.NET MVC, where to store secret token

I have a dilemma where to store secret tokens that I receive from twitter. Options: a. Put it into FormsAuthenticationTicket, encrypt it and put it into cookie. Is this secure enough? b. Put it into Session and put user_name into FormsAuthentciation FormsAuthentication.SetAuthCookie(String.Concat("<em>", screen_name, "</em>"), true...

How to specify "value" for asp.net mvc Html helper droplist

Hi I want to specify a value for each option in the my select list box but I am generating it with an html helper. So I have this <%= Html.DropDownList("DropDownList") %> // controller ViewData["DropDownList"] = new SelectList(MyClass.GenerateListBox()); // MyClass public static List<string> GenerateListBox() { ...

Can a Windows Service access Cache Objects in a Web Page?

Hello, I have created a windows service and I would like it to access a web cache. I have stored a datatable in web cache and I would like for my windows service to access and process it. Is this possible? ...

Where has ViewEngines.DefaultEngine gone an asp.net MVC?

I was recently trying to get the default view engine in ASP.NET MVC 1.0 and couldn't seem to access the ViewEngines.DefaultEngine property that used to be available in the CTP and Beta versions. Does anyone know what the equivalent in the 1.0 release is? ...

Creat a list of links from controller actions ASP.NET MVC

Is there a way to make a list of links for each action in controller instead of having to add <li><%= Html.ActionLink("Link Name", "Index", "Home")%></li> for each item? ...

Are there any Unforseen Difficulties with Offloading Image Storage to Amazon CloudFront using C#?

I'm contemplating the use of Amazon's CloudFront service to offload my web applications image/file storage from my web host. Users of my app can upload images, the image is named and the path is stored in a database. I'm thinking of just having the app upload the image to CloudFront and then change the path to use the CloudFront service...

MVC: Retrieving form values after submitting

I have a form on a dialog box like so: <form action="../ControlerFunction"> <input type=text id="id1"/> <input type=text id="id2"/> <button type="submit"> OK </button> <button type="button" class="close"> Cancel </button> </form> When the form is submitted it hits my controller function, but how can I retrieve the valu...

Making an Ajax call and returning a boolean value in an ASP.NET MVC application

I want to make an ajax call (using JQuery) in an ASP.NET MVC application and return a boolean value, how can I do this? Thanks ...

custom routes with 2 parameters, id and customerid

for example you have custom route like this: CustomerOrder/{action}/{id}/customerid={customerid} the url became like this: CustomerOrder/Create/customerid=1 how can you get the customerid and use it in the view? <%= Html.MenuItem("Back to List", "Index", new { customerID = ???????? })%> ...

Update all properties in list using linq

I need to update all the properties in a list object using linq. For ex.: I have an User List with (Name, Email, PhoneNo,...) as properties. I will get the Users List(List<Users>) from database which is filled with all properties except Email. I need to update all the Email property in the list after retrieving from database with some...

asp.net MVC - Can I reference views from a class library?

In an asp.net MVC application, is it possible to reference views from a class library in the same way that it's possible to reference a class library of server controls or user controls in Web Forms asp.net? I've seen this blog post: http://padcom13.blogspot.com/2009/04/splitting-aspnet-mvc-application-into.html, although the method des...

Inject referrer action via action filter?

Is there a way to inject the referrer action from an action filter? Lets say I have a view that comes from action X. In dies view I call action Y and I want to redirect again to action X. (There are multiple X actions that call action Y). I thought that it could be nice if I had a parameter call referrerAction and an action filter that ...

How do I contract out the design of an ASP.NET MVC Application?

As many of you know MVC applications will have one or more of these View elements. Partial Controls Views Strongly Typed Views And probably others that I don't know yet. As many developers, I am one of those that has no art for design, I can't think about colors, just about logic. I will like to contract out the graphic design of m...

ASP.NET User privileges

Hi, I have created an ASP.NET MVC-application with entity framwork. Due to customer demands I will have to implement a privilege hierachy where different users should have/shouldnt have rights to list/view/edit different kind of objects. And in some cases we need to go even deeper to restrict users from editing a certain property on an ...

asp.net mvc 2 DataAnnotations validation

I have just tried new version of framework (asp.net mvc 2 preview 2) that includes server and client validation with jQuery integrated, looks fine. it has attributes for properties in my model (entity) like DataType. where i expand to see which options i have so it has all what u want u dont, like Duration and PhoneNumber :) but i dont...

LoginBox in MasterPage With ASP.NET MVC

Hi, I'm using a LoginBox placed in MasterPage in order to user be able to login from any site pages. The form action is declared by <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) but after POST and if failed login occurs i need stay on the same page and display Validation Messages. So how can i do to stay on the cal...

In ASP.NET MVC, how can I load script from my view folder?

I've refactored some of my View's javascript out into .js files alongside the views (not in the Scripts folder off root). By default, the handler in web.config for the views stops these being loaded: <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/> However, I want to...

How to put viewdata attribute in to property of asp tag

I'd like to use the old school SiteMapPath in my MVC application how can I pass value to an attribute of the asp tag? To be more precize I'd like to make the code below valid: <asp:SiteMapPath SiteMapProvider="Expression that returns ViewData["CurrentSiteMapProvider"]" ID="SiteMapPath" runat="server"/> ...

Is ASP.NET MVC really only for 5% of Programmers?

I've seen this phrase (ASP.NET MVC is for 5% of programmers) thrown around and have wondered if it is actually true? Since the release of ASP.NET MVC, I have seen more and more questions and tutorials created for MVC while those for WebForms seem to slowly disappear. Looking over stackoverflow questions, majority are about ASP.NET MVC....

ASP.NET MVC - Entities having in-built logic vs Business Services

Hi, My current architecture is based around my entities being simple containers for data with little or no logic within them. Any business decisions are made by Service classes which take entities as arguments and then return data back. However, I'm finding that this approach is becoming a little unwieldy as our systems grow in size. ...