I have an account setup with a credit card processing company and after transaction successful they do something similar to paypals IPN but not as a post. I'm trying to figure out how to modify the register action of the account controller to handle this
and example would be
https://site.com/Account/register?usernam=somename&password=somepassword&other tokens to follow
but all it does if I type the url in by hand to test is spit out the register form. I need it to accept the tokens (i know how to get them) and create the user account (along with a bunch of other stuff) and then just give back a 200 status code (so their
ipn knows it was successful)
You guys have been so helpful in the past and I appreciate all suggesetions
with the simplemembership if you crate a mvc site based on the default template you end up with an account controller wich has a register view. the register view when you navigate to it gives you a form for username and password. I need a way to pass the
username and password to that view from another source via querystring ex /Account/register?username=someuser&password=theirpass instead of the form
I know how to get the values from the query string but if you access the view like that it just gives you the register form, it doesn't take the values from the querystring as from what I can tell its expecting a model thats populated with data from the
form.
So the problem is how to make the register view work by simply using querystring instead of a populated model data ?
otherwise I need an example of how to add a user to the simplemembership programatically and I'll create my own view to process it.
I know how to get the values from the query string but if you access the view like that it just gives you the register form, it doesn't take the values from the querystring
you can not access the View directly. Rather, access an Action that returns the View. In the Action definition make 2 parameters , username and password , and pass to the View via Model.
I can access the view this way I already do it with my signup form, I pass a parameter that tells the signup view which form to show based on wich of 14 diffeent buttons are clicked like so: /Action/Signup?plan=2
trouble is doing the same with the register view it uses a model under the http post section and I can't fiugre out how to create an instance of a model inside the get section of the controller what I want is something like this:
[AllowAnonymous]
public ActionResult Register(string username, string password, string other params)
{
if (the params are not null)
{
create instance of registermodel;
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
*provision user account*
*somehow return a code 200 status so the remote doesn't keep reposting*
}
return View();
}
I know how to do everything but pass the username and password to the WebSecurity.CreateUserAndAccount() and make sure that the http return code is 200. I don't need it to return a full page can be a blank page just has to have a return status of 200 which
I believe any normal page is a 200 status (status ok)
if (the params are not null)
{
create instance of registermodel;
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
*provision user account*
*somehow return a code 200 status so the remote doesn't keep reposting*
}
ANd what do you do not know how to do from above code?!
JackieMay
Member
2 Points
29 Posts
MVC4 simplemembership non paypal IPN
Dec 22, 2012 08:46 PM|LINK
I have an account setup with a credit card processing company and after transaction successful they do something similar to paypals IPN but not as a post. I'm trying to figure out how to modify the register action of the account controller to handle this and example would be
but all it does if I type the url in by hand to test is spit out the register form. I need it to accept the tokens (i know how to get them) and create the user account (along with a bunch of other stuff) and then just give back a 200 status code (so their ipn knows it was successful)
You guys have been so helpful in the past and I appreciate all suggesetions
Jacqueline
ignatandrei
All-Star
134543 Points
21587 Posts
Moderator
MVP
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 04:27 AM|LINK
please explain the problem with simple steps.
Step 1: the user comes to my site and ...
Step 2: I redirect to credit card
....
JackieMay
Member
2 Points
29 Posts
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 07:08 AM|LINK
with the simplemembership if you crate a mvc site based on the default template you end up with an account controller wich has a register view. the register view when you navigate to it gives you a form for username and password. I need a way to pass the username and password to that view from another source via querystring ex /Account/register?username=someuser&password=theirpass instead of the form
I know how to get the values from the query string but if you access the view like that it just gives you the register form, it doesn't take the values from the querystring as from what I can tell its expecting a model thats populated with data from the form.
So the problem is how to make the register view work by simply using querystring instead of a populated model data ?
otherwise I need an example of how to add a user to the simplemembership programatically and I'll create my own view to process it.
ignatandrei
All-Star
134543 Points
21587 Posts
Moderator
MVP
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 12:30 PM|LINK
you can not access the View directly. Rather, access an Action that returns the View. In the Action definition make 2 parameters , username and password , and pass to the View via Model.
JackieMay
Member
2 Points
29 Posts
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 05:14 PM|LINK
I can access the view this way I already do it with my signup form, I pass a parameter that tells the signup view which form to show based on wich of 14 diffeent buttons are clicked like so: /Action/Signup?plan=2
public ActionResult Signup(int? plan) { ViewBag.ID = plan; return View(); }trouble is doing the same with the register view it uses a model under the http post section and I can't fiugre out how to create an instance of a model inside the get section of the controller what I want is something like this:
[AllowAnonymous] public ActionResult Register(string username, string password, string other params) { if (the params are not null) { create instance of registermodel; WebSecurity.CreateUserAndAccount(model.UserName, model.Password); *provision user account* *somehow return a code 200 status so the remote doesn't keep reposting* } return View(); }I know how to do everything but pass the username and password to the WebSecurity.CreateUserAndAccount() and make sure that the http return code is 200. I don't need it to return a full page can be a blank page just has to have a return status of 200 which I believe any normal page is a 200 status (status ok)
ignatandrei
All-Star
134543 Points
21587 Posts
Moderator
MVP
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 06:35 PM|LINK
ANd what do you do not know how to do from above code?!
JackieMay
Member
2 Points
29 Posts
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 06:48 PM|LINK
create an instance of the model in the controller as by default its created in the view and passed not created in the controller
ignatandrei
All-Star
134543 Points
21587 Posts
Moderator
MVP
Re: MVC4 simplemembership non paypal IPN
Dec 23, 2012 10:37 PM|LINK
Model m=new Model();