Take a snapshot of the landing page to analyze its content

At the school district where I work, we have a unique system in place that allows parents to access district and class resources. This system involves using a third-party product, which unfortunately has caused some issues. When a parent logs in, they are actually logging into a site that I personally created. To determine if they are authorized to proceed to the third-party site, I conduct checks on their account. If they are authorized, I automate a form submission with the necessary login details for the parent.

One challenge I face is that our vendor does not consistently update new data. Thus, when a student is newly enrolled at one of our schools, the parent may successfully log in and authorize on my platform. However, upon redirection to the third-party site, they encounter an error message indicating no associated students. Regrettably, I am unable to directly contact the vendor to resolve this issue.

To tackle this problem, I aim to run the form submission to the third party in a "testing" mode. This way, I can capture the resulting page in a buffer and check for any error messages. If an error message is detected, I will retain them on my platform and provide basic resources. Conversely, if no error message is found, the actual form submission will take place, allowing the browser to redirect accordingly. Perhaps utilizing an AJAX solution would be beneficial for this task. Below is the existing code snippet:

ASPX page (with relevant code):

<form method="post" name="loginform" action="http://[destination page]" target="_top">
    <input type="hidden" name="username" value="<% =SessionHandler.UserEmail %>" />
    <input type="hidden" name="password" value="<% =SessionHandler.UserPassword %>" />
</form>

Javascript function (to execute the form submit):

function parentFormSubmit() {
    document.loginform.submit();
}

VB Codebehind snippet:

Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
    Session.Abandon()
    FormsAuthentication.SignOut()
    Page.ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "parentFormSubmit();", True)
End Sub

Answer №1

To achieve this task, one option is to manually perform an HTTPPost using either a Socket or the WebRequest class.

Check out Using the WebRequest Class for more information.

You can also explore Sockets as another alternative.

I highly recommend utilizing the WebRequest class due to its simplicity and speed, with plenty of online samples available for reference.

Best of luck in your project!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining Mongoose OR conditions with ObjectIDs

After querying my Team schema, I am receiving an array of ids which I have confirmed is correct. The issue seems to lie in the fact that both home_team and away_team are ObjectIDs for the Team Schema within my OR statement. Team.find({ 'conferenc ...

Script causing issue with webservice communication

My webservice seems to be malfunctioning. Here is the script that I am using: <script src="Scripts/jquery-1.11.1.min.js"></script> <script> $(document).ready(function () { $('#btn').click(function () { ...

Unlock the power of re-rendering by leveraging the useState hook in combination with React-redux-firebase

Currently, I am delving into hooks with react-redux-firebase and encountering an odd behavior with my "setDataProducts" function. I have implemented useEffect() in a similar manner to componentDidMount(), but I am unsure if this is the correct approach. ex ...

Error: Unexpected token : encountered in jQuery ajax call

When creating a web page that requests remote data (json), using jQuery.ajax works well within the same domain. However, if the request is made from a different domain (e.g. localhost), browsers block it and display: No 'Access-Control-Allow-Or ...

Encountering a 500 server error when using jQuery AJAX for a GET request

Check out the flask python code here: Also, take a look at the html+js in the index.html template: An issue arises where everything runs smoothly on the local Flask server but encounters a 500 error when attempting to search after deployment with Apache ...

Sending form input values to JavaScript

Struggling to design a webpage featuring one text box and a button that, when clicked, sends the value to Javascript for further processing? After spending significant time troubleshooting, I'm unsure of what's causing the issue. Below are both t ...

What is the best method to create random coordinates that fall outside of the circle located within a rectangular area?

Suppose the following scenario: A rectangular area with dimensions length l and breadth b A circle with a radius r The circle is positioned inside the rectangular area as depicted in the image below Check out the image here - Red areas show expected even ...

Is there a way for a button to automatically delete its corresponding index in an array upon being clicked?

I am currently developing a multiple choice quiz where users can input their own questions and answers to create a quiz. I am facing an issue with allowing users to delete questions stored in the question bank. Here is what I have tried so far: bodyText ...

"Unlocking the power of Webpack in Electron: Incorporating and executing a bundled function within the

I am facing an issue where I am trying to access a function from my webpack bundle, but the function is turning out to be undefined. The entire object seems to be empty. In electron-main.js, you can see that I am calling appBundle.test(). I have searched ...

Is there a way to retrieve the widths of several <span> elements at once?

Having a few <span> elements generated dynamically, I need to find out their combined width. Wrapping them in a <div> and using alert($("#spanWrap").width()); resulted in the container's width instead of that of the <span> elements. ...

Vue.js - updating npm to patch version with unclean git working directory

I recently followed a tutorial on how to publish packages to NpmJS. However, I encountered an error when trying to update the package after making changes to the README.MD: npm version patch npm ERR! Git working directory not clean. npm ERR! A .gitignore ...

Utilizing string interpolation within the parameters of an AJAX call

I have a locale variable that can hold values such as en, fr, or es. The goal is to include this locale key in an AJAX request as part of the data parameter. let locale = "en"; let name = "example"; $.ajax({ url: "/path", method: "PUT", data: {chara ...

Tips for inserting a DIV and SCRIPT from a single HTML template into a webpage

I'm working with an HTML template that contains a DIV with a button and a script with a function to call when the button is clicked: <div id="CLC_Form"> various text and checkbox inputs go here... <br> <input type="button" ...

Troubleshooting problem with Slickgrid's keydown function when copying data from Excel

I'm currently using Slickgrid and looking to enable copy-paste functionality from Excel. Although I found a sample that allows this (link here), I've encountered an issue in the example which is less than ideal. In my setup, cells are editable, ...

Update the text on Bootstrap Tooltip when it is clicked

I am looking to update the content of my tooltip when it is clicked. Below is the current code snippet I am using: function myFunction() { var copyText = document.getElementById("myInput"); copyText.select(); document.execCommand("copy"); ...

Customize Bootstrap radio buttons to resemble standard buttons with added form validation styling

Is there a way to style radio buttons to look like normal buttons while maintaining their functionality and form validation? I have two radio buttons that need styling but should still behave like radio buttons. Additionally, I am utilizing Bootstrap for s ...

increase the count by one every second using setInterval

I need my sHand to increase by 6 every second, but currently it only increases once. When I try something like this.sHand++, it works fine and increases by 1 degree per second. However, I want it to increase by 6 instead of 1. Any solutions? data:{ ...

Repeating a post retrieved from a query in the function.php file

Looking to implement an AJAX post filter based on category? Check out this resource I found: The challenge I'm facing is customizing the post output from function.php. Currently, it looks like this: echo '<h2>' . $query->post-> ...

Best practices for setting up CAPTCHA validation architecture on an ASP.NET MVC website

I'm currently working on an ASP.NET MVC project and I need to implement a CAPTCHA feature for users whose submitted content fails the Akismet spam check. While I know how to display the CAPTCHA, I am struggling with planning the architecture for this ...

What is the best way to position a static element next to a Vue draggable list?

I'm currently working on implementing a feature to display a list of draggable elements using vue-draggable. These elements are occasionally separated by a fixed element at specified position(s). My approach so far has involved creating a separate el ...