If I have a custom .browser file, and I want to evaluate what will happen if it is given a particular User Agent, is there any way to do that through the .NET API?
I was attempting to use HttpBrowserCapabilites, but I'm not sure how to load a custom .browser file into that class.
Normally, you should not have to explicitly load the HttpBrowserCapabilities class; ASP.NET will load it for you, as long as you have your .browser file in the right place (in App_Browsers).
However, testing it will be another problem. You can't modify the "User-Agent" HTTP Header from within either the HttpApplication (global.asax) or a custom HttpModule.
This leaves only awkward techniques, such as using Reflection to force the value, or using an external tool (such as Fiddler). Alternately, if you're good with C/C++, you could take a simple example for an ISAPI filter and modify it, then install it in IIS.
Install the User Agent Switcher Firefox extension. It will let you adjust the user agent the browser sends to the web server.
http://chrispederick.com/work/user-agent-switcher/
Related
I have my API documented with Swagger. For developer convenience I would like to provide the swagger GUI on my website as well. However, my provider has not installed the php yaml extension. It implies that I can't use the GUI on my own website.
So, I would like to use a third party GUI. I know that I can use https://petstore.swagger.io/ and enter the link to my yaml file in the text box. This is also not really user friendly. I prefer to open the GUI and specify the yaml when calling the url. For the user the GUI opens with my API definition.
Any thoughts?
If for some reason you cannot host Swagger UI youself, here are some alternatives you can try:
Use SwaggerHub to host your API definition and docs.
Disclosure: I work for the company that makes SwaggerHub.
Use GitLab to host your OpenAPI YAML/JSON file. GitLab uses Swagger UI to render OpenAPI files. Example:
https://gitlab.com/gofus/gofus-api/blob/dev/swagger.yaml
Use https://petstore.swagger.io with the url query parameter to automatically load your API definition:
https://petstore.swagger.io?url=https://yoursite.com/api.yaml
For this to work, the server where your OpenAPI file is hosted must use HTTPS and support CORS.
How do you read a content directory into Blazor.
I tried
Path.Combine(Directory.GetCurrentDirectory(), "..", "_posts");
But this throws an error.
Uncaught (in promise) Error: System.IO.DirectoryNotFoundException: Could not find a part of the path '/_posts'.
The answer depends on why you want to read the directory
If you want to interact with the user's file system, then you need to use the HTML standard for accessing the file system. A blazor wrapper is provided at https://github.com/Tewr/BlazorFileReader
If you want to retrieve files from your server, there are multiple approaches based on how you want to use it. You could set up an api, an mvc instance, or just serve static files. They'll all be relative to your server though, not the current directory.
If you want store data client-side, Flores made a good suggestion to use https://github.com/BlazorExtensions/Storage
Clientside Blazor is running in the same sandbox that javascript is running in. Which means your code has no way of accessing the local filesystem.
Maybe localStorage could be an alternative for you? There is a Blazor package to use it here: BlazorExtensions/Storage
Good morning everyone,
I am developing an app for QNAP which has also a web interface. In my qpkg.conf I set QPKG_WEBUI and QPKG_USE_PROXY and I can see correctly the Web interface inside the QNAP interface once I am logged in. It seems perfectly integrated with the QNAP interface, BUT, I can see it also writing the right url in my web browser, even if I am not logged in the QNAP and I cleared all possible cache/cookies.
I want to give access to my Web interface only to valid users. Unfortunately I do not know how to do it. I tried to write a .htaccess to deploy with my application, but without any success (obviously I can not modify the apache standard configuration, and with the standard configuration I was not able to do it).
The only thing I found, inside the Apache folder, there is a pwauth executable that let me ask for username/password (even if I do not want to ask, I want only to see if the user is ALREADY logged in). Anyway with the standard apache configuration, the external module is not loaded, then I can not use the pwauth inside the .htaccess. Maybe I could create some custom cgi program that call it, but I would prefer to avoid custom solution, I really would like to follow a "standard" way to do it, it should be one.....
I would like to know if there is some QNAP variable to set in the qpkg.conf file, or some configuration to set in a .htaccess that does what I want: grant the access only if the user is ALREADY logged in.
Thanks very much to everyone, I could not find anything in google or in the official documentation.
Background
I have a Single STS server to manage my authentication but I have several websites all of these use the same source files, and web config file.
Each website uses the variation in the URL (PDMNA, CPDEU, FIND) to establish what database it needs to connect to. So it is essential that the reply URL is correct.
This is where the issue starts, I can handle the AudienceUrls as shown below but the realm and reply I can only have one. Which means I always get sent back to PDMNA regardless of the original URL.
So the questions are as follows.
Can I have multiple realm and reply URLS?
Can I have a separate web.config file for each URL but maintain the single set of webfiles?
Is there another options?
An application normally has a single realm;
you can dynamically change the reply adders by subscribing to the appropriate event of the subobjects of the static FederatedAuthentication class.
Finally, you can use web config transforms to specify a configuration per deployed application instance.
I am new to Yii. I have a jquery file manager working with plain PHP script. Now i want to integrate it with Yii Application. The flow is like, from index it will initiate jquery function, which will search for PHP connector script. My problem is, how can i include connector script in Yii so that the Jquery can access it
If you've got the rest of the extension working, then you can create a controller within this extension's directory to handle any actions for it. Then you can use the URL rules in the configuration to send specific URLs to it.
as of now i did not create any extensions, I put the connector script under assets directory and it just worked fine. I am sure this cannot be the best practice. I would like to get help on creating custom extensions for Yii