I am designing a web application using the ASP.net MVC framework. I would like to use Windows Authentication and do Role Checks using the Role Manager SQLRoleProvider.
How can I determine the email address of the current logged on user? Is this even possible?
The application will be deployed in a multi-domain intranet, if that matt...
I need to server parts of my application from different domains.
To be precise I have a sub section of the site that should be served from a region specific domain. For example:
/fr/* should be served from www.domain.fr
/uk/* should be serverd from www.domain.co.uk
and so on.
I'd like to make a route entry that will redirect the requ...
I am considering the StringTemplate view engine for my ASP.NET MVC application. This application will be built with one skin, but I then expect many more, often very similar skins to be developed for it. This is primiarly the reason for my choice of StringTemplate as the view engine, as there will be zero logic in the views.
In my head,...
in my route table I have this entry
routes.MapRoute(
"myRoute",
"route/{controller}/{action}/{id}/{start}/{end}",
new { controller = "Home", action = "Index", id = "", start="", end="" }
);
in my master page I have a line of code like so:
<%= Html.TextBox("foo", "bar") %>
If I access the ...
I'd like to be able to change the extension of a url and recieve the model in a different format.
e.g. if
/products/list
returns a html page containing a list of products, then
/products/list.json
would return them in a json list.
Note: I like the simplicity of the ASP.NET MVC REST SDK, it only requires about 5 lines of code to hoo...
I would like to have filtering page that performs ajax requests to asynchronously update list of results.
There are two comboboxes with option values and one Ajax.ActionLink.
The list is rendered as a partial view inside a div.
I know how to implement the controller part and also the interaction logic. What I am missing is how to pass ...
I want to use the RequireHttpsAttribute to prevent unsecured HTTP requests from being sent to an action method.
C#
[RequireHttps] //apply to all actions in controller
public class SomeController
{
[RequireHttps] //apply to this action only
public ActionResult SomeAction()
{
...
}
}
VB
<RequireHttps()> _
Publ...
What is the best practice for creating/updating the data using the following pseudo view:
parent name field
parent description field
table with child data:
existing fields
fields for child[1] with existing data
fields for child[2] with existing data
empty field[1] for a new child
[add new child button (just creates ...
I noticed that in MVC 2 Preview 2, AreaRegistration is loading the routes for each area in an arbitrary order. Is there a good way to get one before the other?
For example, I have two areas - "Site" and "Admin". Both have a "Blog" controller.
I would like the following:
/admin/ --> go to Admin's Blog controller
/ --> go to Site...
Is it possible (and how) to customize the HTML output of the HtmlHelper.ValidationMessage extension method in Asp.net MVC?
...
Hi All,
I have a .net mvc with the following routes:
routes.Add(new Route(
"Lookups/{searchtype}/{inputtype}/{firstname}/{middlename}/{lastname}/{city}/{state}/{address}",
new RouteValueDictionary( new { controller = "Lookups", action = "Search", firstname = (string)null, middlename = (string)null, lastname = (...
Imagine a page which uses checkboxes to keep track of mailing list subscriptions about pets:
cats-list ( )
dogs-list (*)
birds-list ( )
horses-list (*)
I use ASP.NET MVC's Html.Checkbox extension method in a loop (not shown):
<%= Html.Checkbox("subscriptions[" + i +"]", item.subscribed, item.listName) %>
"i" is the iteration variab...
I'm not sure if this is an ASP.NET MVC specific thing or ASP.NET in general but here's what's happening. I have an action filter that removes whitespace by the use of a response filter:
public class StripWhitespaceAttribute : ActionFilterAttribute
{
public StripWhitespaceAttribute ()
{
}
public override void OnResultExecuted(Resul...
I have the following set of classes that I used to dynamically load in a View. The code below works well when called with .RenderPartial.
public class VirtFile:VirtualFile
{
public VirtFile(string virtualPath) : base(virtualPath)
{
}
public override Stream Open()
{
string path = this.VirtualPath;
S...
Hi,
I'm new to ASP.NET MVC and need abit of advice on how to implement the following.
The site is a heavily used site with roughly 200 users internally (intranet). We use forms authentication hitting a SQL Server DB (not windows integrated).
Some actions are protected, some are viewable by anyone and some are viewable by both - so if...
With this controller method: -
[AcceptVerbs(HttpVerbs.Post)]
public ViewResult Contact(Contact contactMessage)
{
return View();
}
Why does this work...
public class Contact
{
public string Name { get; set; }
public string Email { get; set; }
public string Message { get; set; }
}
<% using(Html.Begi...
I'm having some problems with xVal's clientside validation when it comes to dates. I can't get it to work with a swedish date format which is yyyy-mm-dd, it only seems to work with mm/dd/yyyy. Is there a way to make it work with other date formats?
...
I'm having problems returning a Session value set from mocking using Moq. Using the following
public class TestHelpers
{
public long sessionValue = -1;
public HttpContextBase FakeHttpContext()
{
var httpContext = new Mock<HttpContextBase>();
var session = new Mock<HttpSessionStateBase>();
httpContext.Setup(x => x.Session).Retu...
Hi,
i've got a VS2008 asp.net mvc solution with the projects:
Common
Project_1
Project_2
The common project also contains an "images" folder with "common images" that should be used by both of the 2 projects...
How would i "link" to these folder from one of the projects now, when it should be available via a browser ( e.g. via a pa...
How do I go about passing two sets of Data to a view in ASP.NET MVC?
I've tried a couple of things and neither have worked so I've come to the simple conclusion: I'm doing it wrong.
I have 2 queries:
callRepository.FindOpenCalls() and callRepository.FindAllMyCalls(user)
and I want to out put both sets of data to one view via 2 partia...