私はこの質問をする方法も、これに適切なタイトルを考える方法もありませんが、段階的に説明します。
レストサービス用のプロジェクトとMVC3用の別のプロジェクトがあります。
私のMVC3プロジェクトは、ajaxを介して残りのサービスにアクセスします。
すなわち:MVCビューの内部
<script type="text/javascript">
$(document).ready(function () {
$("#submit").click(function () {
$.ajax({
url: 'http://localhost:2222/RestService/User/Register',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
RollNumber: $("#username").val(),
Email: $("#email-address").val(),
Password: $("#password").val(),
Birthday: $("#bday").val()
}),
success: function (response) {
if (response == true) {
window.location.replace('@Url.Action("Index", "Home")');
} else {
showtooltip('Registration failed.');
}
},
error: function (xhr, ajaxOptions, error) {
showtooltip(xhr.status + ': ' + error);
}
});
});
});
</script>
ユーザー登録が成功すると、mvcは自動的にメールを送信します。
すなわち:電子メールコンテンツのサンプル:
WELCOME TO NEWWEBSITE!
You have successfully registered!
.
.
.
To validate your email address, please go to the link below:
http://localhost:1111/NewWebsite/Auth/Verify?verificationid=3DE4ED727750215957F8A1E4B117C38E7250C33&email=sampleemail%40yahoo.com
それから私は次のステップを行う方法がわかりません。
ユーザーが自分のアカウントを確認するためにリンクをクリックした場合、リンクから情報を取得するにはどうすればよいですか?
検証用のRestサービスを作成しました
[WebGet(UriTemplate = "RestService/User/Verify?verificationid={verificationid}&email={email}", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
public bool VerifyAccount(string verificationid, string email)
{
RestLogicClass.RestLogic.UserComponent svc = new RestLogicClass.RestLogic.UserComponent();
return svc.ValidateEmail(new RestLogicClass.Entities.UserEmail() { EmailAddress = HttpUtility.HtmlDecode(email), ValidateKey = verificationid });
}
このサービスは、次の方法で呼び出すことができます。
http://localhost:2222/RestService/User/Verify?verificationid={verificationid}&email={email}
電子メールが検証されている場合は、mvcの「Verify.cshtml」ページをユーザーに表示する必要があります。
このページには次の方法でアクセスできます。
http://localhost:1111/NewWebsite/Auth/Verify
私の説明を理解していただければ幸いです。私はこの種のデータ処理に慣れていないので、より良いアイデアがあれば共有してください。