asp.net-mvc

Testing a class with HttpContext.Current.Session in ASP.NET MVC

Hello. I'm adding some tests to a class that uses HttpContext.Current.Session internally and we are porting to ASP.NET MVC. My class looks like this: class Foo { public void foo() { HttpContext.Current.Session["foo"] = "foo"; } } I thought to change it like this: class Foo { IHttpSessionState session; pub...

ASP.NET MVC Intellisense not finding ViewData

I am trying to go through the following tutorial on asp.net. When I get down to this code: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication1.Views.Home.Index" %> <%@ Import Namespace="MvcApplication1.Models" %> <asp:Content ID="indexConte...

ASP.NET MVC: Access logs

On an ASP.NET MVC website, what's the best way to implement access logging? I want to answer the following questions: What are the most popular pages? Which pages were accessed in the last 24 hours? etc. I could log in to the server using Remote Desktop and poke through the IIS logs myself (even using Microsoft Logfile Parser), but I...

Keep getting The provider requires SessionState to be enabled on IIS 6

While trying to deploy a simple asp.net mvc project on an IIS 6 server, I keep getting this error "The provider requires SessionState to be enabled". To rule out that I am doing something wrong, I am now trying to deploy just the template you get when you start a new asp.net mvc solution in vs2008. And yes, I have enabled session state ...

NHibernate Update Not working

Hey Everyone.. I can't get my update to work. The test fails and I do not see any update statements being sent to the database. Can someone tell me what I'm doing wrong? This is my repository update procedure: public void UpdateProject(Project proj) { Session.Update(proj); } This is the unit test I am trying: [Test] pub...

ASP.NET MVC HtmlHelper extensions for YUI controls (Yahoo User Interfaces)?

Has anyone written any HTMLHelper classes for MVC that help with Yahoo's User Interface Library? For instance I have written a helper method to convert a 'menu model' into the HTML markup needed to support the Yahoo Menu Control. The MVC pattern works well here because obviously if I chose to switch to a different menu implementation I ...

Integration ASP.NET web forms blogging framework into ASP.NET MVC

Is there any way to use something like BlogEngine.NET (a blogging framework developed on the ASP.NET web forms model) in an ASP.NET MVC application? I want something where I can simply go to http://rooturl/blog and have it fire up the BlogEngine.NET site. I'm assuming that the ASP.NET MVC framework will intercept this call however and ...

Upload images to SQL Server 2005 using ASP.Net MVC?

Hi there, I know there is a way to upload images to the database as image type or varbinary type, however, I searched around the entire week, I am unable to find anything that can help me, so this is really my last resort, if anybody know how to upload images to the database, I am using SQL Server 2005 Express. Thanks ...

Install ASP.Net MVC without administrator rights?

Unfortunately, my company's IT policy doesn't allow me admin privileges to my own machine. However, I want to start working ASP.Net MVC; but the installer won't install the framework w/o admin rights. Is there anyway I can install MVC manually; like copying relevant DLLs somewhere, etc. Any constructive advice is greatly appreciated. ...

What direction should we go for maintaining a document management system?

...

Does System.Web.Caching.Cache make sense in an ASP.Net MVC app?

Since there is no concept of sessions in ASP.Net MVC and each request is independent of each other would I ever make use of the Cache object to internally cache data in order to minimize db access? The output caching functionality is great for caching view data but if I wanted to cache something like a user profile which should be shared...

asp.net mvc : Ajax actionlink or Jquery solution?

Im trying to change images on click similar to what SO does with the vote arrows and checkmark. Im thinking either to : 1- Have each image be an Ajax.ActionLink and return a different image when clicked. 2- Have the images be the background of a Hyperlink and use Ajax.ActionLink to replace the css class to get a new image. 3- Use JQ...

Operation could destabilize the runtime: LinqToSQL

Despite this being one of the best error messages I've ever seen (second only to, "This operation could destabilize the rent in the space-time continuum"), it's also one of the most frustrating. I have developed an ASP.NET MVC site which works perfectly through VS2008. It works perfectly hosted on a local IIS7 server (Win2008Server & W...

ASP.NET MVC server-side processing of Google search results

Hi, This is probably a really simple question but... I would like to do a Google image search (performed by Javascript as there is no other supported option right?) and resize the images on the server-side. My first thought was to have the Javascript generate links like this: http://example.com/Resize.mvc/(link) However, there ...

How do we Pass the Formcollection object for testmethod during Unit Testing

We are Facing an issue of passing the formcollection while unittesting. Is there a way to simulate these formcollection directly without having to set individual parameters. It becomes very tedious process of initilizing each and every object value for huge forms. I suppose there can be a direct way of dng it. Does anyone have idea abou...

Can i return JsonResult from an MVC action and still take advantage of validation?

I haven't actually tried this yet and was hoping for a quick yes or no answer. I am just learning about using JSonResult from a helpful stackoverflow question. What I was wondering was can I use this kind of an actionresult, but still take advantage of the validation provided by the MVC model? If I'm returning a Json result and theres...

Should my MVC controller really know about JSON?

The JsonResult class is a very useful way to return Json as an action to the client via AJAX. public JsonResult JoinMailingList(string txtEmail) { // ... return new JsonResult() { Data = new { foo = "123", success = true } }; } However (at least according to my first impression) this really isn...

Calling a Webservice with ASP.NET AJAX Clientside-only Script from a ASP.NET MVC App?

hi, i am looking for a basic example that shows how i could call a webservice with the client side javascript that comes with the ASP.NET Ajax Toolkit. i already found some example that shows how you do it with ASP.NET WebForms but i am using ASP.NET MVC so no fancy ScriptManager for me :( does somebody know a insightful blog posting ...

Render a view as a string

Hi all! I'm wanting to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: RenderPartial to String in ASP.NET MVC Beta If I use this example, I receive the "Cannot redirect after HTTP headers have be...

Implementing Forms in ASP.net MVC

I have a simple form on a view page, implemented as a user control, that looks something like this: <%=Html.BeginForm("List", "Building", FormMethod.Post) %> //several fields go here <%Html.EndForm(); %> There are two problems I would like resolved, the first is that I would like the controller method that receives this to take a ty...