The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern. The latest release of the framework offers REST-style web services development capability, also known as Web API.
0
votes
0answers
5 views
Javascript / ASP.NET MVC 4 - Using C# Strings in Javascript
I need to be able to access strings held in my C# code in JavaScript. To test, I have tried displaying a message box with the C# string in JavaScript (I am using this string literal and the message ...
1
vote
0answers
8 views
how to use service stack IoC in controller when MVC run side by side with Service Stack
I create a ASP.NET MVC4 application, run side by side with Service Stack.
The default Ioc container(Funq) works fine with Servie Stack services which configured in AppHost.
But I'd also use same Ioc ...
0
votes
1answer
23 views
How to create a Custom AuthorizeAttribute that redirects?
I want to create a custom AuthorizeAttribute that
checks for user login.
if logged: redirect to place1.
else: redirect to place2.
checks for user activation.
if logged && not activated: ...
0
votes
3answers
24 views
How to work with specific parameter of a Controller
The goal
Treat an offer as a category in controller.
The problem
I have a controller whose name is ProductsController. Inside it, I have an action called Category. When this method is requested, it ...
0
votes
0answers
7 views
<Bind(Exclude:=“CurrentPrice”)> Not Working in MVC 4
I'm writing this in ASP.NET MVC 4 and have been trying to have have a field in the form where one of the fields are excluded from being written into. I have the following model in the ...
0
votes
1answer
17 views
Coffeescript to hide/display HTML elements
I have four HTML elements; buttons...
<button type="button" data-bind="onclick: unlink, style: pairnotresolved" id="unlink">UnLink</button>
<button type="button" ...
0
votes
0answers
7 views
How to register MVC4 portable areas and routes in nUnit tests?
My MVC4 solution contains three projects:
Web, an MVC 4 web application
MyAccount, a portable area
Tests, a class library that leverages nUnit (and moq)
Web's global.asax defines some routes, as ...
1
vote
1answer
51 views
What is the Lifecycle of a static field
What is the lifecycle of a static field in C# MVC:
private static InventoryMgmtContext _dbContext = new InventoryMgmtContext();
public ManageWorkOrdersAppServ()
: base(new ...
0
votes
0answers
15 views
get data of a user that his profile seems like: www.facebook.com/profile.php?id=0123456789
I wrote the next code:
var client = new FacebookClient();
string str, profile_name;
foreach (var myFriend in @Model.Friends.Data)
{
str = myFriend.Link.ToString();
profile_name = ...
1
vote
1answer
12 views
Install older NuGet package for entire Visual Studio solution
It's simple enough to install an older version of a NuGet package into a particular project (see this answer).
However, I can't figure out a way to do this solution-wide.
This is a common enough ...
0
votes
1answer
53 views
C# Redirect to action with data
I'm having an extremely hard time figuring out how to use my Return RedirectToAction to send it to my other view in a different controller with parameters.
I have the following code
return ...
0
votes
0answers
12 views
Telerik MVC model returns NULL
The model that I bind to Telerik grid is NULL in the post method of the controller.
@model Empyrean.SafeHarbor.Web.ViewModels.DashboardViewModel
Html.Telerik().Grid(Model.DataFiles)
...
0
votes
2answers
20 views
Disabling Account controllers in asp.net MVC4 based on web.config setting
I have an ASP.NET MVC4 application in which I would like the AccountController to be easily enabled/disabled by a setting in the web.config. As I would like registrations and logins for a period, and ...
0
votes
1answer
15 views
ASP.net MVC 2 RenderAction with model throws URI too long exception
In ASP.net MVC 2, I am using Html.RenderAction to render a partial view, RenderAction takes a Model as a parameter, code below.
<% Html.RenderAction("ReviewPartial", review); %>
And the ...
5
votes
2answers
45 views
MVC - Site still accessible if not logged in?
I'm converting an existing ASP.Net webapp to MVC / Entity Framework, and I'm an issue with the login functionality.
I have my login page working, that is to say, if they don't enter the correct ...