POST method for Clickable URL - http

We have a simple user database with user email contacts. The email needs to be verified. We send a verification code in the form of a clickable URL which user can click to verify their email. The clicked URL results in a GET call whereas we need it to make a POST instead. Is this possible?
In simple words: user sees a normal http://.... URL, which when clicked results in a POST instead of the usual GET.

No, unfortunately the server cannot retrieve the verification code. My only suggestion is to header("Location: x"); on the page where they click at the footer. ;D

Related

gravity forms querystrings in email

I have two gravity forms on my website that pass the email parameter via query strings. However, an email is sent to the user after he/she submits form one. In that email, I would like to have the url with the query string there so that the user can click on it. Whenever I try to do this by appending the mergetag to the end of the url, it never functions.....I am doing something like this www.mywebsite.com/new_form_page/?email={mergetag_email}. Is there a proper way to get this done?
Thanks
So I found out the issue. Wordpress removes formatting so all I had to do was click the box next to disable formatting and it worked fine....

make action method only accessible through redirect

I'm trying to submit a form. When the form is submitted I want the form to dissapear and the text Thanks for your support. An e-mail will be sent to you as soon as possible. to show.
I think the most logical way to go by this is by making the form submit to the action SaveMessage() that redirects to the action RedirectToAction("MessageSaved") that returns the view with the message. If it isn't, please say so. This is for practice.
The problem is that the message can be viewed as well by going to /Support/MessageSaved. How do I prevent users from accessing it by url, but make the action accessible by redirectToAction()?
Set a value in TempData before the redirect. In the MessageSaved action method, check for that value before showing the form. Otherwise, redirect to another page.

How to check for valid user and then continue submitting data

I am using ASP.NET to submit data from a form to a database.
But before submit I want to check if the current user us valid. If not I want to use the login control registration form where an existing user can enter his user id and password then go back to the previous page to submit the form data.
Example:
Assume a page having 3 textboxes and one button. Once the user clicks the button I want to check if the user is already logged in or not. If not I want to open the login page so he can provide his credentials and after that execute the previous page submit function without the user having to click again.
I think you're asking about form validation? The easiest way to do this is with a postback. Put a button on the form, that button will post back the form to itself, and fire the button_Click event. Inside that event you can put some C# code that will validate the user's name and password. Then you can show a label on the form that indicates the credentials are not correct.
Hope that helps!
You can save information about user, using session:
Session["UserLoggedIn"] = true;
When you want to check, if user is logged in, check like this:
if(Session["UserLoggedIn"] != null)
{
// User is logged in
}
else
{
// User is not logged in, so redirect to login page
Response.Redirect("~/login.aspx");
}
if you want to redirect back, after successful log in operation. you can use QueryString. So instead of:
Response.Redirect("~/login.aspx");
redirection will be:
Response.Redirect("~/login.aspx?RedirectUrl=your current form url");
In login page, you can read QueryString:
string redirectUrl = Request.QueryString["RedirectUrl"];
After login operation, use redirectUrl value, to redirect back:
Response.Redirect(redirectUrl);
i hope i have tried to understand you.
firstly, i would like to explain what you want.
You want to check user logged in before submit, and if he is not logged in you want him to redirect to login page after he logs in u want to come back on the same page. and perform your click function.
RetrunUrl
return url in your querystring will help to return to back to your original page. and u can save the details of the previous page in session and once user logs in and redirects back to original back perform your click event there. by validating you session value,
once you are done with your whole process remember to abandon your current session details

Drupal: send output to user in form's submit handler, instead of redirecting

I have this basic Drupal scenario and question:
I have a form which accepts some input from user, and a submit handler which should process data and show the result to user. In other words, I don't write anything in database or set e variables etc., just show some output to user.
I was wondering how I can do this, because a submit handler redirects the flow to another menu item -which the form values ($form_state) are not available anymore. Redirecting form to itself is not useful, because I just receive the raw posted inputs -not processed $form_state.
How can I prevent the redirection and just show some output to user in submit handler?
Thank you.
When you are building your form you want to set re-direct to false:
$form['#redirect'] = FALSE;
There is more on redirect here: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#redirect
If I have understood your question correctly this is what you are after.

ASP.NET page redirection / crosspost

I have 3 asp.net pages: Search.aspx, Results.aspx and Login.aspx.
Now I want anonymous users to be able to search, so everyone can use search.aspx. This page calls
Server.Transfer(Results.aspx)
and therefore shows the results. Now when the user is not logged in, a link to the login page is displayed on the Results page. The problem is:
After the login, I want the user to be redirected automatically to the Results page. However I do not succeed so, as the PreviousPage property of Login.aspx is always null. And when I use
Request.UrlReferrer.LocalPath
it's the link to Search.aspx but not Results.aspx.
Also, when the user is on the Results page, how do I enable him to go back by clicking a link and all his search input criteria (like in textboxes) on the Search.aspx is still there so he can refine the search after having seen the results? Whenever I send the user back, all user input is lost.
I still haven't figured out if I should use a normal hyperlink, a linkbutton and how to retrieve the previous page url or preserve the input data.
I can use AJAX if that is any help, but a "pure" asp.net solution would be preferred.
When you do a Server.Transfer it is a serverside redirect...meaning the client still sees the original URL. You need to post the search criteria to the results page, store them locally, show the login link. When they are logged in you can redirect to the results page and rehydrate the search critera and show the results.
Try using Response.Redirect("url") instead of Server.Transfer. When you use Server.Transfer, the url on the client will remain the Search page and not actually redirect to the Results.
You can use User.Identity.IsAuthenticated to check if the user is logged in and show/hide the login button based on that.
To keep values for the page, you could store them in Session, then have the Search page look for them and, if they exist, place them in the controls.
You can also embed the URL you want to return to after login into the querystring if you want.

Resources