asp.net-mvc

How to maintain CDN image links in dev and production sites?

I have this ASP.NET MVC application that I now want to separate out the image links to a CDN. At this moment, images typically have this markup code: <%= Html.ActionLinkWithImage("/Content/Img/Image1.png" ... This works fine in development using the local web server (Cassini), and also when published the prod server. But now I want th...

Ordering Entity Framework sub-items for EditorFor

I've seen http://stackoverflow.com/questions/3565249/ordering-sub-items-within-ordered-items-in-a-linq-to-entities-query which suggests that there is no way of getting the repository to return sub-items in an entity graph in a specific order. If that's right, any thoughts on how to order the items in an EditorFor ? i.e. //This works ...

ASP.NET Code Behind - DB data to HTML

Howdy! :D How are ya? I'm a PHP developer initiating my studies of ASP.NET, out of necessity, and I would like to know the easier way to retrieve some data from DB into an array and use this array to write some HTML. In PHP I'd pull the data, then use a foreach() loop to write, for example, rows of a table. But I don't have idea of how ...

How does one output arbitraty text from INSIDE a control class in C# ASP.NET, MVC?

Is it possible to say something to the effect of 'SomeClass.Out.WriteLine("hello world")' and have it actually show up for the browser to render? I ask, because I notice that the HtmlHelper BeginForm implements IDisposible. So at the end of the using block, a closing tag is written to the browser. I am not saying I would use this pr...

General .NET MVC2 questions.

I am just getting into .NET MVC2 (.NET in general even) and I am having a hard time getting familiar with the "flow" of things. The MVC framework, I get.. for the most part. The part that I am getting tripped up on is applying standard programming practices to .NET MVC. For example public ActionResult Index() { var dataContext = new...

How to create breadcrumb in asp.net mvc

I want to create breadcrumb for my whole application in asp.net mvc. I have idea of how to create sitemap control in asp.net but how to create in asp.net mvc? ...

Is NLog work with customErrors?

when i use <customErrors mode="Off"/> and i have an error on the screen it writes to log file but when i use <customErrors mode="RemoteOnly"/> then i see my custom error page but error not catches but logger :-/ ...

DatabaseFileLockedException driving me crazy

I am following the example here: http://developer.db4o.com/Forums/tabid/98/aft/10114/Default.aspx to setup my MVC2 app with db4o using an HttpModule. I also have a LINQPad instance open to query the data as I develop. The web app seems to work like a charm, but LINQPad keeps getting DatabaseFileLockedExceptions until I close down the w...

Multiple URLs and single codebase with ASP.NET MVC

Hey, I'm pretty new to ASP.NET MVC and I just want ask of this scenario is possible and, if so, could anybody provide any resource links on how to implement it. Say I have a site that can be accessed from www.mysite.com, can I also have the same site load up through www.mysite2com, www.mysite3.com and so on? effectively providing the a...

How can I route to an action with an input button in asp.net mvc?

I have an input button and I want to redirect to a view or action when it's clicked. How can I do this? ...

ASP.NET MVC - Return dictionary parameters

Alright, I'm trying to pass a Dictionary, where key = int, and value = Prototype into my view. Prototype: public class Prototype { public string Value { get; set; } public string PropertyName { get; set; } public Options Type { get; set; } } After the Dictionary has been passed into my view I'm doing a foreach loop t...

How to integrate DotNetOpenAuth and openid-selector

I created a DotNetOpenAuth MVC 2 project using the visual studio template, and have it working. However, the sign in page takes a long time to load. Not quite sure exactly what is going on in the library, but it seems like there is some kind of javascript slowing down the login image button UI from rendering quickly. I'd like to instea...

Calculating ratings/points in a community driven site

To learn ASP.NET MVC, I am thinking of creating a community forum like SO where people can rate posts, users etc. and the user can thereby gain points. I just can't figure out if the points should be added to the user profile whenever an action is done (post rated up/down, user created new post etc.) or if it should be calculated from th...

How to route a query string with "?" and how to handle it

In my global asax file, I want to map a route such as this: http://domain.com/add/link?url=http%3A%2F%2Fgoogle.com And then catch it using my LinkController with action called Add. Do I do this? global.asax-> routes.MapRoute( "AddLink", "Add/Link?{url}", new { controller = "Link", action = "Add" } ); LinkController-> ...

ASP.NET MVC - Populating a form dynamically through the database

I am porting a search application from Classic ASP to ASP.NET MVC2. One of hte pages is a dynamically populated search form that is broken up into 4 categories, each with 2 rows. The client is able to uncheck options for each of these categories. When this happens, each category is dynamically repopulated top to bottom, left to right....

Dynamic Action-based URL menu problem c# mvc

Hi, i'm having issues implenting a dynamic action-based menu system in a PartialView as below: <ul class="tabs"> <li <% if (ViewContext.RouteData.Values["Action"] == "Index"){ %>class="active"<% } %>><a href="/talent">Home</a></li> <li <% if (ViewContext.RouteData.Values["Action"] == "account"){ %>class="active"<% } %>><a href="...

Force RedirectToAction to return to the calling view

I have several views that submit to the same controller's ActionResult and would like the RedirectToAction statement to return to the one that called it: return RedirectToAction([view that called it], new { ID = ID }); thx ...

ASP .NET MVC Webpage Cannot Be Found

I cannot get ASP .NET MVC 4.0 to work when deployed on IIS 7.5 (Windows 7 x64) in Integrated Mode (or any other mode for that matter, but let's focus on Integrated Mode). I am following these very simple steps Create a new ASP .NET MVC 2 Web Application Hit Run. It works. Edit the project configuration to use my local IIS web server (...

How to implement OAuth2 provider and consumer in C# .NET

I have been doing a bit of searching around on oauth2 and think it may be a good fit for some WCF rest services I am building out that will be consumed by some WPF apps and MVC web apps. The idea would be that the user is initially asked to login with their username / password and receives an access token which gives them access to the a...

ASP.NET MVC Single Sign-on and Roles

I have basic Single Sign-On working across 2 MVC sites (call them SiteA and SiteB) using something along the lines of the following method: http://forums.asp.net/p/1023838/2614630.aspx They are on sub-domains of the same domain and share hash\encryption keys etc in web.config. I've modified the cookie so it is accessible to all Sites o...