The IControllerFactory 'MyWebSite.WebUI.Infrastructure.NinjectControllerFactory' Did Not Return A Controller For The Name 'Admin'

Nov 26, 2010

I am getting the above when I try and open a view in a controller in an Area. Ninject is set up as follows:

public class NinjectControllerFactory : DefaultControllerFactory
{
private IKernel kernel = new StandardKernel(new RLSBCWebSiteServices());

[code]....

Has anyone managed to get Areas working with NinjectControllerFactory, or is there something wrong with my set-up?

View 1 Replies


Similar Messages:

MVC :: Error Occurred While Creating A Controller Of Type 'WebUI.Controllers.NavController'?

Mar 22, 2010

I am trying to implement the SportStar from Steven Sanderson book but I am encountering a problem when I want to create the NavController. The code is below

public NavController(IProductsRepository productsRepository)

View 2 Replies

MVC :: Out Of The Box MVC2 Controller / Delete Controller Is Refusing To Return Any Class Information

Nov 6, 2010

my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.

Function Delete(ByVal id As Integer) As ActionResult

View 4 Replies

MVC :: Return A View Of A Different Controller?

Aug 29, 2010

I came upon this when had problem trying to return a view of a different controller.

In controller1, I have view view1.

In Action1 of controller2, I wanted to do something like:

public ViewResult Action1()
{
return View("/Controller1/View1");
}

but, found out, I couldn't do it. So I searched and found this:[URL]

One guy there responded and said that, for my case, it is possible to do things like below:

return View("~/Views/Controller1/View1.aspx");

this is considered an acceptable MVC practice. Is it OK, good, perfect to do so in the asp.net MVC realm?

View 5 Replies

C# - Return Different Views In A Controller?

Mar 20, 2011

If I have a controller and I want to return a view based on what my conditional logic goes to, is that possible? I have different types of models that i want to insert into a view DEPENDING on my conditional logic (if statements) Can i do this? and how would I do this

View 2 Replies

MVC2 - How To Return A File From A Controller

Nov 23, 2010

Possible Duplicate: How to create file and return it via FileResult in ASP.NET MVC?

ASP.NET MVC2: How to return a file from a controller? I want to do this so the user can download the file from server.

View 1 Replies

To Return The Same Data For Every .Net MVC Action In A Particular Controller?

Mar 26, 2011

I have a controller with several actions that all return a set of data that's the same among them all. Instead of adding the data to the ViewBag in every single action, is there some pattern or attribute or something I can call or set to add the same data to the viewdata or viewbag for every action, or some other better way to perform the get the same data in every view without calling the method in every action?

View 2 Replies

MVC :: Return A Double Value From Controller Action?

Jan 11, 2011

i am trying return a double value from controller action. when i alert(result) it works well but when i return a function it did not work. alert undefined value.

//this is action
public ActionResult GetPrice(int id)
{
double price = ProductList.Where(d => d.ID.Equals(id)).Single().Price;
return Json(price, JsonRequestBehavior.AllowGet);
}

when i click $('#btnAdd') i wanna get price

$(document).ready(function () {
$('#btnAdd').click(function () {
//var itemPrice = GetPrice();
alert(GetPrice()); // this return undefşned value........

View 6 Replies

Controller AJAX Method To Return ActionLink

Apr 4, 2011

I am fairly new to MVC and just trying to achieve something which I think shouldn't be too complicated to achieve. Just want to know what the best approach for that is. I have an Event-RSVP application (NerdDinner kind) where you go to view details of the event and then click on an AJAX link that will RSVP you for the event.

<%
if (Model.HasRSVP(Context.User.Identity.Name))
{
%>
<p>

You are registered for this event!

<%:
Ajax.ActionLink("Click here if you can't make it!", "CancelRegistration", "RSVP", new { id = Model.RSVPs.FirstOrDefault(r => r.AttendeeName.ToLower() == User.Identity.Name.ToLower()).RSVPID }, new AjaxOptions { UpdateTargetId = "QuickRegister"})
%>
</p>
<%
}
else
{
%>
<p>................

View 2 Replies

Return A Partial View In JSON From A Controller In MVC?

Mar 16, 2011

I have a list of items(surveys) displayed on my home page. When I click the edit button for a particular item I have a modal pop up with the items details to edit. When the user clicks Save I submit the form via ajax. Depending on whether ModelState.IsValid == true I want to update the modal with validation information or close the modal and update the list of items with the new information.

This is how I am submitting the form:

[Code]...

My Questions

The only thing I can think to do is return JSON from my controller with a flag indicating the state of the ModelState.IsValid and the corresponding partial that I should show.

1) How would I do this?

2) Is there a better way?

Update

I found this: [URL]

but it seems more likely that I am going about the whole thing incorrectly.

View 3 Replies

MVC :: How To Return Data Loaded Via AJAX To Controller

Dec 7, 2010

display the first tier of data so the user can select and tweak desired rows. On occasion, they will want to drill into a row to see the children and select/tweak them. After a tweaking session, I wanted to be able to commit.

If I build an aggregate ViewData and prepopulate it, I can display it just fine in the View, and I get the collection back in the postback just fine.

Starting with empty child data, I experimented with jscript to fetch that data and displayed it by adding elements with jquery.

What I can't figure out how to do is to return that data to the controller. The newly added elements aren't in "Show Source" ... I heard elements added via jscript are not posted back. I even tried adding items to a prepopulated list ... only those items originally passed in are returned.

View 3 Replies

Is It Correct Pattern To Return Different Views From MVC Controller

Jul 9, 2010

I have an application that has an public 'end user' mode and a 'back office' mode. Both 'modes' pretty much share the same controller logic but the user interfaces for these different 'modes' are radically different. Using the out of box default routing that you get when a project is created for the first time I have something like the following:

Controllers
HomeController.cs
Views
BackOffice
Index.aspx
Public
Index.aspx
Shared
BackOfficeSite.Master
PublicSite.Master
In my HomeController.cs I have logic that looks like this:
public ActionResult Index()
{
var devices = DeviceRepository.FindDevicesByCustomer(100);
if(IsBackOffice())
{
return View(@"~/Views/BackOffice/Index.aspx", devices);
}
return View(@"~/Views/Public/Index.aspx", devices);
}

Is this the correct way to be doing this or am I digging myself an anti-pattern hole? I'm using ASP.NET MVC 2.

View 3 Replies

How To Return A Partial View From A Controller With Different Model

Mar 18, 2011

returning a partial view from a controller with different model than my main View. For example:

blic ActionResult Index()
{
//myModel - get Some Types
return View(mymodel);
}
[code]...

View 1 Replies

MVC :: Return Text Stream Of HTML From Controller Action?

Nov 6, 2010

How does a controller action return an HTML stream as the View? ( in place of the name of the View file )

I want to return a simple "error detected" or "action completed" page to the browser. And I dont want to clutter up my project with yet another view. The return string being "<html><body><h1>Error. Customer xxxx is not found</h1></body></html>"

( thinking about it, better to have a general purpose view in a folder named "Common". Then pass the message text in ViewData. Still curious to know how to return an html stream. )

View 1 Replies

How To Return Errors To View From Controller Not Tied To A Specific Model Property

Aug 26, 2010

Curious what the best practice is for returning errors to a view from a controller where the error isn't really a validation error, but more like "user not found" or "service timeout" type of errors. (in ASP.NET MVC2 framework)

I've been adding them to the ModelState's model errors, but that doesn't seem appropriate. (although easy to implement and maintain)

Example - A user tries to log in, and their credentials do not match a known user.

View 1 Replies

Connect Application To Telephone Infrastructure?

Nov 22, 2010

I am having a ASP.net web application which is hosted in an internet server. Now i got a requirement to integrate this website with a computer telephony infrastructure. The details are as follows.

The user will be located in a building having TAPI standard, LAN - CTE infrastructure enabled telephone system and the logged-in user should be able to connect to the phone line (extension no:) within the same building through the browser. When a call comes to that phone line, a popup should appear in the users browser displaying the number of the caller. I am having the following doubts in implementation of this functionality

How should I connect (communicate) my application with this LAN - CTE infrastructure? The LAN - CTE infrastructre is simply an API having no web services exposed from their side for this purpose. So think I will have to write an extra wrapper class just above the LAN - CTE infrastructure to facilitate this.

Do I really need to connect to the telephone line across the internet as this logged user and the extension no: will be in the same local network?

View 2 Replies

Security :: X509 - Client Certificate Infrastructure

Sep 9, 2010

I dont have a lot of background with SSL and X509 configuration and support with my Asp.Net application, so I was wondering if someone can explain or point me in the right direction to MSDN or any other article or posting explaining if it's possible to do what I am looking to support in my environment.

I have IIS 6.0 with SSL (Verisign cert) as well as "Require client certificates" working against a local installation of Microsoft Certificate Services, https://<domain>/certsrv, where users can request and install client certs (both xp clients for basic
mode, and Vista/7 for advance mode).

Here's what I am up against:

I have a segment of users coming from a virtualized server environment where this environment does not store personal settings for more than 48 hours. It's not an internet cafe, but rather an actual business where their IT staff uses server images to reimage each virtual server in the farm every 48hrs. Thus losing all users data in the "Current Users" Certificate Stores.

The IT staff give users a network folder share to store any personal items (docs, spreadsheets, links, etc.). The servers consist of Windows Server 2003, and will be migrating to Windows Server 2008 in the next 6-9 months.

These users have rights in Internet Explorer to navigate to my certsrv site and use activex to to request and install certificates then clode and reopen the broser to navigate and render the asp.net app.


Problem:

It's a pain to ask the users to request and have issued a client certificate every 48 hours.

The IT staff of this company has asked if I can create some sort of certificate that they can load in the "local computer" certificate store, NOT the "Current User" store, that will be made part of their base image for all their servers, and that this certificate is then used to properly authenticate all users on these servers to my IIS with "require client certificates" selected.

Question:

Is this possible, and if so what can I do on my side to create the proper certificate to give to the IT staff at this business to put into their servers "local computer" certificate store? I assume either under the Personal->Certificates store, or under the "Trusted Root Certification Authorities"->Certificates store. Thus allowing any user of these servers in their thin client virtual environment to open I.E., navigate to my site and select a certificate from the "Choose a digital certificate" popup that allows them to render my Asp.Net application, or avoids this popup altogether.

If this is the wrong forum to post in, please advise and I will move. Probably due to vernacular on my part, I have been unable to find any resources on here, MSDN or Bing to help me solve this problem.

View 1 Replies

C# - How To Implement Windows Service Kind Of Infrastructure

Jan 10, 2011

I have limitations to host Windows Services in my web hosting provider. But i need run small task frequently.

Do we have any other framework/api which provides similar infrastructure like "Windows Services" from ASP.NET?

View 4 Replies

Permission On Admin Folder, Only For Role=admin?

Jun 13, 2010

I have an Admin folder which contains 4-5 aspx pages. I want to that only user with role="admin" can view those files. What settings i need in web.config?

View 1 Replies

C# - Using Grasp Controller With MVC Controller - How To Make An Object Always Visible For A Controller

Dec 28, 2010

UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.

View 1 Replies

MVC :: Control Admin Panel Users / How To Crease An Admin Panel

Feb 21, 2011

i want to crease an admin panel. but i do not use asp.net default membership system.

i know actions enable access can be determine by [Authorize] attribute. but my admin has 10-20 controller and about 100 action.

i do not want to signature all of actions by [Authorize] attribute.

all controller must be required login if user did not login.

View 3 Replies

User Is In Role "admin" But (Authorize (Roles="admin")) Won't Authenticate

Mar 15, 2011

I found a great answer on SO describing how to set up custom user roles, and I've done the same in my project. So in my Login service I have:

public ActionResult Login() {
// password authentication stuff omitted here
var roles = GetRoles(user.Type); // returns a string e.g. "admin,user"
var authTicket = new FormsAuthenticationTicket(
1,
userName,
DateTime.Now,
DateTime.Now.AddMinutes(20), // expiry
false,
roles,
"/");
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName,
FormsAuthentication.Encrypt(authTicket));
Response.Cookies.Add(cookie);
return new XmlResult(xmlDoc); // don't worry so much about this - returns XML as ActionResult
}
And in Global.asax.cs, I have (copied verbatim from the other answer):
protected void Application_AuthenticateRequest(Object sender, EventArgs e) {
var authCookie = Context.Request.Cookies[FormsAuthentication.FormsCookieName];
if (authCookie != null) {
var authTicket = FormsAuthentication.Decrypt(authCookie.Value);
var roles = authTicket.UserData.Split(new Char[] { ',' });
var userPrincipal = new GenericPrincipal(new GenericIdentity(authTicket.Name), roles);
Context.User = userPrincipal;
}
}
Then, in my ServicesController class, I have:
[Authorize(Roles = "admin")]
//[Authorize]
public ActionResult DoAdminStuff() {
...
}

I login as a user with the "admin" role, and that works. Then I call /services/doadminstuff - and I get access denied, even though when I put a breakpoint in Global.asax.cs, I can see that my roles do include "admin". If I comment out the first Authorize attribute (with roles) and just use a plain vanilla Authorize, then I can access the service.

View 1 Replies

MVC :: Pass Parameter From Controller To View And Back To Another Controller?

Aug 16, 2010

I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.

My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)

Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.

My Gift List controller knows the PersonID I want to pass but the view doesn't.

How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?

View 2 Replies

MVC :: Session Vs TempData / How To Persist Values From Controller To Controller

May 30, 2010

I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.

How can I persist values from controller to controller?

Should I use Session? TempData?

I am using Structure Map for IOC.

Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?

View 10 Replies

MVC :: Get The Current Action / Controller Name In A Controller Or Class?

Mar 14, 2011

How do you get the current action / controller name in a controller or class?

i can't show it in my view but that's not what i want.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved