asp.net-mvc

Compress Filter + MVC + Yahoo YSlow

I've been using Yahoo's YSLOW to try and make my pages go faster at AgentX I am using the below compress filter. When I run the site through visual studio YSLOW says that all the files are compressed and I get an A when I view the live site it gets an E and says my files need to be gzipped. Can anyone explain? public class Compre...

MVC ActionLink adds VS solution name to url

For some reason when I run my project locally, everything works just fine. When I publish my site live to my shared hosting server, the actionlink causes links to come out as http// www.mydomain.com/MySolutionName/Account.aspx/LogOn when it should be http// www.mydomain.com/Account.aspx/LogOn Any ideas? ...

Writing to Output Stream from Action

For some strange reasons, i want to write html directly into output stream from Action Method. ( I understand MVC sepearation, but this is a special case. ) Can i write directly into httpresponse output stream ? In that case, which IView object, the Action Method should return ? Can i return 'null' ? ...

asp.net open source projects

Hi everyone, Wanted to know which open source projects (eg blog engine.net, etc) is good to explore/read its source code. The main purpose is to help a beginner asp.net/c# developer learn about how to code the presentation/business/data layers cleanly. One ASP.NET for Webforms. Maybe another for ASP.NET MVC. Preferably for .NET ...

More control on ASP.Net MVC's Authorize; to keep AJAX requests AJAXy

I have some action methods behind an Authorize like: [AcceptVerbs(HttpVerbs.Post), Authorize] public ActionResult Create(int siteId, Comment comment) { The problem I have is that I'm sending a request through AJAX to Comment/Create with X-Requested-With=XMLHttpRequest which helps identify the request as AJAX. When the user is not l...

ASP.NET MVC: How to handle cross-action TempData and ViewData

I'm trying to find a good way to handle the following scenario (I'm still kinda new to this): A user can register through my site using an RPX/OpenId provider. Step 1: The user authenticates through a provider. The provider returns a temporary token to one of my action methods. Step 2: I use the token to grab the user's profile inform...

How should I create a user preference attribute?

In my current asp.net mvc project a user should be able to log in. When logged in a set of preferences can optionally be set. Some of those preferences are general (e.g. prefered site language etc), but some are specific to this project only (pre-defined query filtering etc). Since these preferences are present in a lot of different pla...

Is MVC from Microsoft the new Struts for Dot net ?

I have not used MVC but am merely wondering as a Java person, hence the q. ...

ADO.Net Entity Framework/Linq

I'm look at learning a bit more ASP.Net MVC and Linq To Entity. I'm working on a project using this and am having a problem with the following line of code ViewData["ProjectName"] = db.Projects.FirstOrDefault(p => p.ProjectId == task.ProjectId).ProjectName; It works fine when the record exists but if no record exist it errors becau...

asp.net MVC - how to get complete local and global resources

I'm localizing application and need to provide JSON representation of local and global resources for JS part of application for all views. My current idea is I'd implement HtmlHelper extension methods like GetLocalResourcesJSON/GetGlobalResourcesJSON which should encode all resource keys+values and return them JSON encoded as string (I'd...

WCF Service with asp.net mvc application

I have started using asp.net MVC and as traditional way I want to keep my data access layer in WCF service. How can I achieve that using asp.net MVC ? Scenario I started a test application in asp.net MVC which Displays, Inserts and Edit data. I successfully created that by adding 'ADO.Net Entity Data Model'. So now if I wanted to move...

Doing something that'll take a while in ASP.NET MVC, while reporting progress to the user?

In my ASP.NET MVC application, one of my actions is going to take a while -- it kicks off a sequence of other tasks. I'd like to report progress to the user. I want to display text -- I don't want a simple progress bar or spinner. How should I go about doing the two parts? First, how do I display progress to the user? Second, how should...

How to define the RouteTable in VB.NET ?

[Route Table 1][1] This image shows how to define the RouteTable in C#, using the Route Class. How to define it in VB.NET? ...

Recreate Linq to Sql code when table changes where customised

I have a Linq to Sql Model generated by VS ORD, but I want to make a changes to it to work around a couple of issues. I can change the designer.cs generated code , but if I ever need to recreate a table within the model, then I delete it and drag it back to the ORD. This however loses all of my customisations. Is there another way? I ha...

Problem creating my own extension to HtmlHelper

I have an extension method to HtmlHelper: <%= Html.MyMethod( params )%> It works in visual studio, but throws (at runtime): Compiler Error Message: CS0117: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'MyMethod' The odd bit is that this does work: <%= HtmlHelperExtensions.MyMethod( Html, params ) %> Why does ...

ASP.NET MVC - View with multiple models

I am trying to generate such HTML <form action="/some/process" method="post"> <input type="hidden" name="foo.a" value="aaa"/> <input type="hidden" name="bar.b" value="bbb"/> <input type="submit" /> </form> so it can be processed by this Action: public ActionResult Process(Foo foo, Bar bar) { ...

How to define the ActionLink in VB.NET ?

ActionLinks This Image shows type-safe method of defining the Actionlinks ,how to define it in VB.NET ...

Asp.NET Forum and Blog sharing Membership

I am looking to create a blog and a forum on a new website. I would like for users to register to post in the forums and post comments on the blog as well as having thier own public profile page. I have experience with BlogEngine.NET so was looking to use that. I have no experience with .NET forum software at this time so I am researchi...

Load file after page is complete without redirecting

Hi, I am trying to do pretty much the same, as is for example on sourceforge. After a user creates some data, i generate a file and i want it to be offered to him after a page loads. However, i know almost nothing about javascript and simple copy paste of < script type="text/javascript"> var download_url = "http://downloads.sourceforge....

How to release resources used by HttpPostedFileBase?

After I upload a file I try to delete it from my PC but it is saying that the file is in use. What code am I missing to free the file to be deletable? ...