My SwaggerUI works like a charm, but why I'm getting an additional Error section on the page? Not able to find out the exact source of it i.e why it is coming.
I got the issue with my SwaggerUI. I had implemented an ErrorController to override the way WebApi handles bad request. It was this controller which was appearing in the API documentation. I hided this controller from the the API documentation using IngnoreApi attribute. More details here
https://github.com/domaindrivendev/Swashbuckle/issues/90
Related
If anyone can please help me with how to retrieve the navigation menu with REST and Graphql API.
If no API is available, then how can I write a custom Navigation API?
We need to get the below data with API. see screenshot
Use this in query. it worked for me. Remember to replace "main-menu" with the header code of your site.
{
menu(handle:"main-menu"){
items{
id
tags
title
}
}
}
currently, there is no API endpoint that would allow you to access the navigation. However, seeing that the navigation in your screenshot mainly contains collections, probably it would be a good starting point for you to read those? This can actually be done via this call:
GET /admin/api/2020-01/collection_listings.json
You can find more info here:
https://shopify.dev/docs/admin-api/rest/reference/sales-channels/collectionlisting#index-2020-01
Hope this helps,
Roman
I got jQuery File Upload along with Backload up and running in Visual Studio, straight out of NuGet. The demo works just fine, I can upload files. I'm using the default configuration.
http://blueimp.github.io/jQuery-File-Upload/basic.html
https://github.com/blackcity/Backload
BackloadDemo/Index.cshtml has the following form:
<form id="fileupload"
action="/Backload/UploadHandler"
method="POST"
enctype="multipart/form-data">
It works, but I can't figure out how it works. Where does /Backload/UploadHandler link to? I cannot find any reference of this 'UploadHandler'.
I was trying to figure the same thing out and I have found the answer.
If you check the Backload.dll you will see a namespace of Backload.Controllers with a class named BackloadController.
This is the controller that is picking up and handling the request. ASP.Net uses reflection to gather all classes that end with Controller and inherit from Controller. The reason you can't see this controller in the Controllers folder is because they are embedding the implementation inside the Backload.dll
From your second link:
Backload is a professional, full featured file upload controller and handler (server side) for ASP.NET
So the request to /Backload/UploadHandler either gets intercepted by a handler or picked up by a controller.
If your actual question is "How do I incorporate Backload in my project", then refer to their documentation or show relevant code and explain what you did, what you expect to happen and what actually happens.
I'm upgrading from .NET 2.0 to MVC 4. Back in .NET 2.0 webform, we had to inject license information on the fly to the footer of the software by override the "Render" function in .aspx.cs page (using HtmlTextWriter), find a particular spot of the footer and then insert the license text info there.
The reason I don't want to directly put that in the viewstart page or any razor page themselves using HTMLhelper is because I don't want my customers to mess with it. So hard code is not an option.
I use Glimpse and I see Glimpse is enabled by adding a HTTPModule,etc in web.config and magically, an icon appears on my app. Something similar ?
Bottom line is, I need to hijack the finished HTML output, modify it and return the final result to client.
How do you do this in MVC? HttpModule?
Thanks!
Glimpse uses a feature of ASP.NET called a ResponseFilter to change the output HTML on the fly.
The ResponseFilter, in the case of Glimpse, is set inside the HttpModule - but it could be set anywhere.
Four Guys From Rolla has an old but still relevant article on how to create ResonseFilters.
I am trying to get the twilio.MVC helper attribute ValidateRequest to work on a MVC 4 controller running in AppHarbor. I can't seem to get it to work and I assume it is because my app is running behind a load balancer. I've tried supplying the UrlOverride parameter in the call, but I can't seem to get it correct. Assuming my appharbor app url = myapp.apphb.com, my controller = callhandler, my action = handlecall, how should I be calling the ValidateRequest attribute?
ValidateRequest[("MYAUTHTOKEN","myapp.apphb.com")]
Doesn't seem to work, I constantly get a 403 Forbidden error back.
Just an FYI- I am decorating the individual MVC action and not the entire controller at this point.
In case anybody runs into this same issue, I got this working by specifying the UrlOverride as a Named Parameter along with the controller and the action, like so:
ValidateRequest[("MYAUTHTOKEN", UrlOverride="http://myapp.apphb.com/controller/action")]
I just started using Yii, coming from Codeigniter (CI). I'm trying to set up a situation where the application will check a users credentials before they can even access the site. In CI, I would create a parent controller, put my checks in there, and then inherit that parent controller. I've been trying to do the same thing with Yii, but with no luck.
I first created an init() method (for some reason I can't put the code in a __construct() method). I then perform my check, which works fine. I can throw a new CHttpException, but that looks ugly. How do I use Yii's built in error handling to accomplish what I want to do?
For simple login rules you should just implement the 'accessControl' filters from Yii see Yii documentation on authorizations.
Another way would be to throw the Exception like you already did, and write custom Http error views, place it in the yerfolder/protected/views/system/ (see the yii/framework/views directory for examples)
I solved this by sending the error to the site/error view and then calling Yii::app()->end() to keep the child controllers from loading.