Last post Jun 22, 2020 01:27 PM by KathyW
Jun 22, 2020 12:04 AMemail@example.com|LINK
am trying to redirect my page to yahoo.com. For this, I have the follwoing code in standard ASP.net page
on my .aspx page, I have the code like so:
<asp:Button ID="btnSubmit" runat="server" Text="Submit" data-icon="check" OnClick="btnSubmit_Click" />
In my code behind, I have the following code:
Th page does not go to Yahoo.com page and if I run the developers tool on the page, I see this error:
Access to XMLHttpRequest at 'https://www.google.com/' (redirected from 'https://localhost:44302/Decision?AspxAutoDetectCookieSupport=1') from origin 'https://localhost:44302' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Below is the screen shot:
This is a simple Reponse.Redirect to outside URL. . I cannot use CORS header policy in this case. I dont see anything in Response.Redirect that has a CORS header policy
Any help will be greatly appreciated. The name of the page is Decision.aspx.
Jun 22, 2020 03:34 AM|KathyW|LINK
The error detail talks about failure to have access to a resource at google.com, redirected from localhost../Decision?AspxAutoDetectCookieSupport=1
It does not seem to involve your redirect to yahoo.com.
Jun 22, 2020 05:17 AMfirstname.lastname@example.org|LINK
Do you have any suggestions on how to fix it.
Jun 22, 2020 06:34 AM|XuDong Peng|LINK
Have you read this document? It maybe useful for you.
I created a demo and tried to do the same thing as you, but failed to reproduce your issues(Redirect succeeded).
Jun 22, 2020 01:27 PM|KathyW|LINK
You haven't shown any code that relates to fetching something from google, so no, I can't tell you how to fix it.
What is your page fetching from google, and do you have authorization to do that? Is it something your production URL has permission to fetch, but localhost doesn't?
Only you know what the Decision page referenced in the error is doing.