How to add Headers when using Blazor NavigationManager.NavigateTo - redirect

Is it possible to specify headers when redirecting to an url (not in the same domain)
Blazor NavigationManager.NavigateTo(url)
thanks

Related

SAP UI5 / Cannot get data from Service through destination

I am developing a ui5 app using the managed app router to try to consume destinations from the BTP. The destination uses a BasicAuthentication with a technical username and password and the connection works but when I am trying to access the data from my UI5 app I get a 401 Unauthorized response code.
In the xs-app.json of my app is the authenticationType xsuaa. I can provide some file and snippets if this helps.
Does anyone have an idea what the problem is? Thanks for your help.
yes, you need to have your SAPUI5 app send the HTTP Authentication header in the request. You can use Chrome DevTools to see that HTTP header; it should have the name 'Authorization' followed by a 'Basic' + basic64 cipher.
(exemple here How to hide the basic authorization credential in browser response header? )
About Basic Auth : https://learn.microsoft.com/en-US/aspnet/web-api/overview/security/basic-authentication
Instead of setting directly that HTTTP header (with username/password) in your app, I'd recommend to use your server authentication default process.

URL redirection in client side

I have a list of current_urls that need to be redirected to new_urls list. Using mapping in the server.js file, the URLs are being redirected only when the url is hit on the server, but if I navigate from the client side, I get 404 because that url doesn't go the server.
So, how can I handle the client-side navigation redirects?
P.S. Using NextJs only.

Swagger Multiple hosts in same Json spec

I am using a single host for documenting REST API's in Swagger Ui 2.0 but I need two hosts in the JSON file for calling rest API's one for http and the other one for https. Is it possible? If yes then how to do that?
Thanks!
The way swagger figures out URLs is this:
You provide the basic one in index.html from where the swagger.json gets generated. The generated swagger.json does not contain a URL per se, or any http/https information. It only has a path relative to the base URL you provided.
After the UI gets generated based on generated swagger.json, the "Try it out" buttons execute GET/POST/PUT requests based on the URL info in the address bar. check this piece of code in your swagger-ui.js:
if (url && url.indexOf('http') !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
So, if you want to use https, use https in the address bar to hit Swagger UI. You will also need to mention the same in your index.html, and in swagger-ui.js in the above code.

server side redirect in classic ASP on IIS7

I'm trying to implement a simple 301 redirect from mydomain.com/page1.asp to mydomain.com/page2.asp. These are dynamically generated product pages of an ecommerce store, so they don't physically exist as files.
In Apache it's simple to do with .htaccess but all I found are ways to redirect static pages, that actually exist on the server, such as placing the code below in at the top of the existent file:
<%#LANGUAGE="VBSCRIPT"%>
<%
' Redirect to the new location with the correct 301 Moved Permanently status
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/new-page.php"
%>
Is there a way to redirect a dynamically generated page in IIS7 using classic asp?
UPDATE
Based on the comments received, I need an URL rewrite module. #ZippyV suggested this one
You want to rewrite your URL requests instead of redirecting them.
IIS has a URL Rewrite module which you can download here. Another nice feature is that it can transform your outgoing html too.
More articles on how to use the IIS URL Rewrite Module: http://www.iis.net/learn/extensions/url-rewrite-module

How to modify GET request size (IIS Express)

I have coded a web application that runs on IIS Express. I want to send large data set to server(over 4MB) and get response. (I have implemented this as a REST service).
When i tried ,i realize that I can only have 311bytes long URL.
So how can i change that?
as i know IE allows 2083 length URL as default. and there should be a way to configure IIS express via web.config or applicationhost.config right?
can anybody help me?
You need to use an http post verb to send the data, instead of trying to send it encoded in the URL as a GET. In straight HTML, this would involve having a form tag with a submit button. What framework are you coding this in? (asp.net, mvc, php, etc?)