Good day!
I've recently switched from IIS 6.0 to IIS 7.x and I'm in search of error handling technique of my dream for ASP.NET MVC 2.
What I want to achive:
Handle all unhandled exceptions in one place (preferable in Global.asax handler)
Custom handlers for 404 and 403 errors (both for MVC controller\actions and static files). These ...
i need a login widget thar appears on every page:
when user logs in he is redirected to the same page
if login fails user redirects to the same page and see error message
widget is rendered with Html.RenderAction
when submitting login form, i take current page url (with java script) and sent it to server - so I can redirect user to...
I ve seen in twitter, i can get a user view page by just typing in the url say http://twitter.com/pandiyachendur. How to do the same with asp.net mvc? I dont know how twitter does it?
...
Hello all,
I have a small trouble.
I want to show just a part of a string for example:
Instead: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
Just a: "Lorem ipsum dolor sit amet, consetetur sadipscing..."
Which method can ...
bit of a newbie to mvc. i am having trouble with the following scenario:
I have a view with the following:
<tr>
<% foreach (var game in (IEnumerable<Game>)ViewData["Game"])
{ %>
<td>
<input type="checkbox" name="selectedObjects" value="<%=game.Id%>" />
</td>
<td>
...
I would like to control how many characters users can write in TextAreaFor.
How can I do it, with a remaining counter if characters under the textarea??
My TextAreaFor looks like that:
<%= Html.TextAreaFor(m => m.Answer,7,72,null) %>
...
I'm trying to subclass ValidationAttribute in ASP.NET MVC 2 to make something along the lines of an ImageValidator class which would make sure that an uploaded image (from <input type="file">) has the correct mimetype, doesn't exceed the maximum allowed file size, etc.
So where do I start? I get the feeling like images are an exception ...
I want to save user image into a database in C#. How do I do that?
...
I have some processes that run without an HttpContext in an ASP.NET MVC web application. This process needs to be able to determine the physical path to the Contents directory of the application for reading/writing data. But, since it is without an HttpContext, I don't get to use fancy things like Server.MapPath and such. Suggestions?...
I have 10 tables with the same design. Each of them has an IsActive Collumn.
EX:
Category
CatID
CatName
IsActive
Product
PrdID
PrdName
IsActive
Is there a way to create a generic method to update the IsActive column.
public void Deactivate<T>(T TEntity)
{
//Put the code to update
//IsActive
}
I Read ...
I have a partial view (ascx) for displaying the top x articles of a person's RSS feed:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Models.Article>>" %>
<% foreach (var item in Model) { %>
<a href="<%: item.Url %>"><%: item.Title %></a><br />
<%: String.Format("{0:g}", item.Date) %...
This is a strange one. I changed something (not sure what) and now my app's view doesn't compile at runtime.
The view itself is strongly typed:
<%@ Page Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MyNamespace.OperatorModel>" %>
When I visit the page, it fails to compi...
Good morning! I Have an issue with a wysiwyg editor that saves html to my database. On my news articles page, it works fine. I have
<httpRuntime requestValidationMode="2.0" />
in my web.config, and
[ValidateInput(False)]
above my edit http post action, and yet my other page with the same wysiwyg editor is rejecting my request wi...
I know this question has been asked and answered in several ways, but none of them get to the crux of the matter that I need to understand. In WebForms, we 'subvert' the rendering process and write straight to the Response's output stream. How does one achieve that using a Controller Action, to write CSV to a file for Excel?
...
I am using a few sessions that should be terminated when the user is done. I stumbled on these 3 session killers. When is the best time to use these as I use sessions more time than not. Also, is there any other session termination I am not aware of?
...
I'm using MvcRecaptcha to prevent bot posts for a complex unauthenticated client form on an ASP.NET MVC 2.0 site.
I only want to require one correct CAPTCHA entry from an unauthenticated client, even if some of the form's inputs are incorrect.
I have tried using a Session["CaptchaSuccess"] = true; variable to suppress Html.GenerateCapt...
(I am using ASP.Net MVC, but this seems like a more generic MVC question)
Say you have a domain model representing a person, and you have a view for editing a person. Included in the Person domain object is a State of Residence property, and in the view you want a dropdown that lists states.
Is there any reason not to create a view ...
I have a Bootstrapper that looks through all Assemblies in an ASP.NET MVC application to find types that implement an IBootstrapperTask interface, and then registers them with an IOC Contrainer. The idea is that you can literaly place your IBootstrapperTasks anywhere, and organise your Projects how you please.
Code for Bootstrapper:
pu...
Back in April I was listening to Herding Code episode 77 about MvcContrib.
There Eric Hexter announced UI Testing Helpers as a big upcoming feature.
Now several months later I was searching the web for any information about UI testing with MvcContrib.
Unfortunately I found almost nothing:
This sneek peek:
http://codepaste.net/cw8ie4
...
Yes, I know that in ASP.NET MVC you have to use ViewModels. But I'm tired of writing countless amounts of ViewModel classes. Besides I'd like to just pass the Validation model to the view, instead of that I have to pass the whole ViewModel, so I get ugly code like
Html.TextBoxFor(m => m.TopicModel.Title)
Instead of
Html.TextBoxFor(m...