FilePathResult or custom Action Result?
To send pdf files (or any other file type) to the browser, I've seen examples that use the FileResult class or a custom Action Result. Is there an advantage of using one over the other? Thanks ...
To send pdf files (or any other file type) to the browser, I've seen examples that use the FileResult class or a custom Action Result. Is there an advantage of using one over the other? Thanks ...
Hey everyone, I've just started on a new project which currently contains a fair few ViewModel DTO classes. I'm wondering whether it would be useful and even good practice to replace many of these DTOs with Tuples and to use that as my method of transfering a bunch of objects to my views. What do you think? Is this a correct usage of ...
I have a .NET MVC project where I have implemented Facebook connect. This worked fine in my development environment but is causing me issues after deploying to the production server. I serve the facebook connect button from the Index page of my home view like this <fb:login-button perms="email" onlogin="window.location='/Account/Authent...
I'm trying to aggregate all my Performance Counters into one UI, and I'm having a hard time with the PerformanceCounterCategory.GetCategories() method. It keeps throwing Access Denied, however I'm impersonating as the Administrator account on the remote machine. I have a feeling that this call does not use the impersonated user's creden...
In my model metadata class, I'm using the data annotation attributes for poperty validation. This works fine. I have created an Attributes namespace and 4 custom validation attributes deriving from System.DataAnnotations.ValidationAttribute in it; all these attributes validate the entire model itself, because they have to compare multi...
Hello, I've created a rudimentary RSSActionResult in ASP.NET MVC to generate an RSS feed based on new items in my ecommerce store - new items, sale items etc. That part was easy and works well. I would like to go one step further and create a feed that is user specific. For instance - show users new products of interest based on their p...
Hello, I am saving both the markdown text and html versions of text in my database. I have a question and answer site. When users browse the questions they are viewing snippits of markdown. They should only be viewing plain text just like when browsing questions on stackoverflow there are no markdown text or html text shown. Is there a w...
I'm trying to determine if MEF is a the proper direction our application framework should be taking. From my reading of MEF, our framework doesn't seem to 'exactly' fit in, but I'll see if any experts can guide me. Our framework allows us to have one core website and dependent assemblies deployed to one place (and fixes or features are...
I have found 4 or 5 examples of "lowercase routes" in C# however when I use the telerik code converter, I get a bunch of errors. Namely something to do with "extension methods can be defined only in modules." Does anyone have any good resources on how to map routes to lowercase in VB? EDIT: here is an example of some converted code t...
So I set this above my Controller: [Authorize(Roles="Administrator")] The problem is whether they are not logged in, or don't have the right role, it redirects them to the login page. Is there a way to have it handle authorization and authenticate differently? ...
I have an Intranet site reading the windows user name and using it for authentication in the website. My code works locally but does not read the login name when hosted using IIS 6 on Windows Server 2003 with anonymous access checked. If I un-check anonymous access then in Firefox I keep getting a pop up for username and password which...
I would like to be able to use DataAnnotations when working with my model, so for instance be able to write stuff like [DisplayName("Title")] [StringLength(256)] public string title { get; set; } I also want to be able to use the column with linq which has led me so far to adding table and column linq mapping annotations such as [C...
This is my first question, and it is probably a poor one, so please be gentle. Working on my first ASP.Net MVC2 web app recently, I came across some issues when I needed to select multiple values in a list box. I worked around it with some jQuery, but went ahead and put together some very simple code to demonstrate. I'm using EF for t...
In webforms I used a repeater inside a repeater(Hieararchical model). How can I achieve the same in MVC? Example: Data1 Data2 subdata1 subddata3 subdata2 subdata4 Data3 data4 subdata5 subdata7 subdata6 subdata8 I also require a two column layout as shown above. Any ideas ?? ...
i would like to disply some fields in case that a radio button was pressed and hide them otherwise. how can i do it? ...
I have Forms authentication and I need a custom object to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal. To get this, I listen to PostAuthenticateRequest event, then read from the DB all the user data I need to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal, then I instantiate custom IPrincip...
I have a confirm box and redirect to an action but it is not working.. <script type="text/javascript"> function quitProgram() { var answer = confirm("Are you sure you want to quit your current program?"); if (answer) window.location("http://www.google.com"); else window.location("h...
I am setting the disposition of either inline or attachment based on users selection. It works but very intermittently. Once I select inline for the same file in the same browser, it works as expected. Once I switch to attachment, I don't get the desired results unless I close and reopen the browser. I do flush the context and clear it a...
Hello, I would like to redirect all www traffic to non-www traffic i have copied this into my web.config <system.webServer> / <rewrite> / <rules> <rule name="Remove WWW prefix" > <match url="(.*)" ignoreCase="true" /> <conditions> <add input="{HTTP_HOST}" pattern="^www\.domain\.com" /> </conditions> <action type="Redirect" url="...
Anyone know if it's possible to move the HomeController and Home related views into the Areas directory? I'm trying to keep my root directory nice and clean and avoid having the ~/Views and ~/Controllers directories if I can. Furthermore, I can see it causing some confusion by having to explain that those root folders are for homepage s...