Skip to content

Is there a way to prevent or override the initial redirection to the default page and directly navigate to the destination URL #52

Open
@mukulnuance1234

Description

@mukulnuance1234

I have a web application integrated into a WPF application using WebView2. My web application consists of two pages: the first page is the landing or default page located at "localhost/ABC/Search," and the second page is "localhost/ABC/Add."

In my WPF application, when a specific event occurs, I'm performing the following actions:

UTF8Encoding utfEncoding = new UTF8Encoding();
byte[] postData = utfEncoding.GetBytes(jsonContent);
MemoryStream postDataStream = new MemoryStream(postData.Length);
postDataStream.Write(postData, 0, postData.Length);
postDataStream.Seek(0, SeekOrigin.Begin);
CoreWebView2WebResourceRequest webResourceRequest = WebView2Environment.CreateWebResourceRequest(
    "localhost/ABC/Add",
    "POST",
    postDataStream,
    "Content-Type: application/json"
);
Webv.CoreWebView2.NavigateWithWebResourceRequest(webResourceRequest);

After executing this code, the application first redirects to the default page ("localhost/ABC/Search") for a few seconds before finally redirecting to the destination URL.
Is there a way to prevent or override the initial redirection to the default page and directly navigate to the destination URL?

Let me know if you have any questions or need further clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions