I have a problem, I can't direct display test.html without using controller.
I used this http://localhost.mywebsite/test.html
and this is the error display
here is my VS studio
Note: I will not use controller to this display html like
public virtual ActionResult test(Index index)
I want is to direct view will pass through controller.
any Idea please? thank you.
Related
If you open an ASMX file in a browser, it shows you a nice summary of all of its functions.
Is it possible to do the same for all public functions in ASP.NET MVC controller ?
No, not from a browser.
The whole point of having a controller is to control what is displayed in the view. The controller should not present itself to the browser. By it's very nature a controller is designed to present something else to the browser, namely the view:
You could, however use a tool like Glimpse to get a peak at those public functions.
I have a MVC application where I have installed umbraco 6.1.6 nuget package.Now I am trying to call a controller from a view using Jquery AJAX function. The controller is placed in MVC controller folder and it is inherited with UmbracoApiController. I have tried to follow the Umbraco API document ,But everytime my request is send it redirects to 404 page. I have tried the same using umbraco 7.1.4 downloaded from here and it works fine for me. Can anyone suggest a solution for this.
The request url I have used is as follows :- /Umbraco/Api/[ControllerName]/[ActionName], I have also tried /Umbraco/[YourAreaName]/[YourControllerName] , but that too doesn't work for me.
Check different things:
reboot the site (touch the web.config)
did you BUILD the code? If you put it in app_code is it picked up automatically, otherwise you need the DLL to be in your bin directory.
what do the log files in /App_Data/Logs tell you?
You can insert your own logs by invoking
LogHelper.Info<myclass>("some message")
are you really really really sure you have not overlooked something from the documentation?
are you sure your controller inherits from UmbracoApiController
have you tried adding [MemberAuthorize(AllowAll = true)] to the api controller or the method?
double check the URL. you probably mistyped the name. The controller is the complete name without "controller". Try the code below to find back the exact url.
The code below came from a usercontrol which i used in a dashboard for the end user. I guess it's pretty easy to convert it into a Razor macro. If this is not returning a thing, you did something wrong from the list above.
var requestHandler = HttpContext.Current.Request.RequestContext;
var urlHelper = new UrlHelper(requestHandler);
var actionlink = Umbraco.Web.UrlHelperExtensions.GetUmbracoApiService<MyApiController>(urlHelper, "MyMethodName");
I've created a joomla component which consists of a html form, and when I try and browse to it:
index.php?option=com_helloworld
I get an error 404, component cannot be found.
I'm following this tutuorial:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Developing_a_Basic_Component
Can anyone please tell me how I can browse to the page?
UPDATE: here is the link to my sample component, its a basic html form.
http://tinyurl.com/d6tj7rz
Many thanks
IIRC, even if a component is not installed correctly, you can still access the code if it's on the server, from my experience. But that may have been a 1.5 thing.
If you don't specify a view in the URL by passing &view=viewname, AND you haven't set a default fallback view, then you can't expect to have anything come up.
For a good example on how to set a default view, look in components/com_contact/controller.php line 38.
Within the main controller's display method:
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'categories');
$this->input->set('view', $vName);
I'm not sure if the question title really explains what I want to do, however I will explain below:
I am using the Visual Studio MVC project template and I have changed some of the tabs to map to different actions from different controllers. However I want to make one of the tabs to open a view that will again have links for different administration actions.
The problem I have is that I am unsure where to place this view as it doesn't really belong to an admin controller as each tab on this view will link to a list view in another controller. In effect it is a sub _Layout view, as it doesn't have anything to do with a controller.
I hope I have made myself clear enough!
You can place this view in the Shared folder since it will be used by multiple controllers. Or, you could place it somewhere else and reference it by using the full path to this View/Partial View
In a Controller
public ActionResult SomeAction(){
return View("~/Path/To/View/ViewName.cshtml");
}
In a View (Razor)
#Html.RenderPartial("~/Path/To/View/ViewName.cshtml");
With that said, the Shared folder makes the most sense since it will be shared across multiple controllers.
Hello in an MVC3 application,
I want to put a password on a page.
The page is accessible from an action link that calls an ActionResult in the controller. And returns the view with the model.
What is the best way or easiest way to add a password to the page.
Something like a popup that shows and you have to put a password and if you put the wrong password you don't see the page (the view is not loaded)
Thanks
You can put a filter on the page's get action.
look at the following link
http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/understanding-action-filters-cs