login.aspx email link syntax?

I would like to know how the url-link that I recieve in my email works. When I 'Register' into a new web site, I'm sent a link to click on to complete the registration.

Q. How does this work?
LVL 1
kvnsdrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

asdaveyCommented:
Websites that use this registgration method want to confirm that the email address that you've supplied is a real email address. Sometimes they also wan't to confirm that a real person is signing up.

To acheive this the system will generate a unique id to associate with your registration information. This information is then probably persisted to a database table. The system then will generate an email that contains a link and will send this email to the email address you supplied earlier. The link/url embedded in the email will contain the unique identifier (I've seen numbers used as well as GUID's)

Example:

http://www.mynewsite.com/registration.aspx?registrationID=12341234123412341234

(If the email is a HTML formatted email, you may not see the unique identifier or the url at all since a lot of sites use this form "click <a href="http://www.mynewsite.com/registration.aspx?id=1234123412341234">here</a> to register".)

When the website receives this request, it uses the unique number to find your registration information that you entered earlier and marks the data as being confirmed (since you have confirmed that you received the email, and have clicked on the link).

HIH

Andy
0
kvnsdrAuthor Commented:
Q. Do you know of any 'How-to' resouces so I may implement this on my web site?
0
asdaveyCommented:
Is the end goal here to implement some form of email validation?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

kvnsdrAuthor Commented:
Yes. Just not sure how to read the actual login page particulars to insert the user and password like you have shown earlier.

Here's part of the IE 'source' from the login.aspx

 <form name="form1" method="post" action="login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
0
asdaveyCommented:
You probably need to first understand how to develop a form in asp.net so that you can store the form's details in a database.

This is a fundamental principle for asp.net development, and I would recommend reading through some tutorials on the basics first. Once you've got those down pat, you will find that developing your own email validation solution will be pretty simple.

I recommend the following site for a start: http://www.w3schools.com/aspnet/default.asp

I hope I haven't misunderstood your last comment and am telling you how to suck eggs. If I have, I apologise.

Andy
0
kvnsdrAuthor Commented:
I program in C# and ASP .NET for a living. I'm not offended. Nobody really know who their talking to at EE. Anyway I have email validation worked out just looking for a way to make the one-line-link work like other sites do. For instance, to place a request to Arin.net I would do the following:

System.Diagnostics.Process.Start( "http://ws.arin.net/cgi-bin/whois.pl?queryinput= " +  Textbox1.Text);

I just not sure how to accomplish the same effect with an ASPX page.

Here the whole aspx page (Internet Explorer -> View -> Source) to give you an idea:

As you can see there are two textboxes and one 'Logon' button that clients normaly use.

1. <input name="Email" type="text" id="Email" style="width: 164px" />
2. <input name="Password" type="password" id="Password" style="width: 164px" />
3. <input language="javascript" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(''); " name="Submit1" type="submit" id="Submit1" value="Logon" />
--------------------------------------------------------------------



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
      Logon
</title>
 
   
<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

   
</head>
<body>
    <form name="form1" method="post" action="login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTI4NzMzMDkzMGRk5dSJKZV+EHY2amSuN/3Xlx5Uss8=" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>



<script src="/shoppernet/WebResource.axd?d=p1zcT8-Oqe2qvWEncKN-AF0ssH_Qm7uCps5KoJon1qk1&amp;t=632753793973281250" type="text/javascript"></script>
<script type="text/javascript">
<!--
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
// -->
</script>

    <div style="background:buttonface"><h3><font face="Arial">Logon:</font></h3>
    </div>
        <input name="txtIp" type="text" value="Your IP Address Is: xx.xx.xx.xx" id="txtIp" style="color:White;background-color:DarkRed;width:272px;" /><br />
    <table id="TABLE1">
        <tr>
    <td>Email:</td>
        <td style="width: 160px"><input name="Email" type="text" id="Email" style="width: 164px" /></td>
        <td><span id="RequiredFieldValidator1" style="color:Red;visibility:hidden;">*</span>
        </td>
        <td>&nbsp;
        </td>
    </tr>
    <tr>        
    <td>Password:</td>
        <td style="width: 160px"><input name="Password" type="password" id="Password" style="width: 164px" /></td>
        <td>
        <span id="RequiredFieldValidator2" style="color:Red;visibility:hidden;">*</span>
        </td>        
    <tr>    
    <td>
        Remember Me?</td>
        <td style="width: 160px"><span disabled="disabled"><input id="Persist" type="checkbox" name="Persist" disabled="disabled" onclick="javascript:setTimeout('__doPostBack(\'Persist\',\'\')', 0)" /></span>
        </td>
        <td></td>
    </tr>
</table>

<input language="javascript" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(''); " name="Submit1" type="submit" id="Submit1" value="Logon" />
  <input language="javascript" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(''); " name="Submit2" type="submit" id="Submit2" value="New User" style="width: 77px" /><br />
   

<span id="MsgAdd" style="display:inline-block;color:Red;font-family:Arial;font-size:10pt;width:480px;"></span>

   
<script type="text/javascript">
<!--
var Page_Validators =  new Array(document.getElementById("RequiredFieldValidator1"), document.getElementById("RequiredFieldValidator2"));
// -->
</script>

<script type="text/javascript">
<!--
var RequiredFieldValidator1 = document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1");
RequiredFieldValidator1.controltovalidate = "Email";
RequiredFieldValidator1.errormessage = "*";
RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator1.initialvalue = "";
var RequiredFieldValidator2 = document.all ? document.all["RequiredFieldValidator2"] : document.getElementById("RequiredFieldValidator2");
RequiredFieldValidator2.controltovalidate = "Password";
RequiredFieldValidator2.errormessage = "*";
RequiredFieldValidator2.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator2.initialvalue = "";
// -->
</script>

<div>

      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBwKsu4WdAgKY+5bqDwKS18aDDQLSxeCRDwLfi9riDgLVo8avDgLwjOTECPz4RugL6hEvppBgebTvzxS6tL5S" />
</div>

<script type="text/javascript">
<!--
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
    ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    else {
        return true;
    }
}
// -->
</script>
        </form>
</body>
</html>

<script language="JavaScript">
<!--
var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

//-->
</script>

0
asdaveyCommented:
:-$

So do I understand in that you would like to be able to populate the login details based on a hyperlink?

ie if you gave me the url 'http://www.mywebsite.com/login?userid=1234', then when I clicked on the link I would see the login page with the username and password fields filled in ready for me to click OK?
0
kvnsdrAuthor Commented:
Yes and if possible "Post" so the click is done as well.
0
asdaveyCommented:
Well to populate the form variables (lets say they are txtUsername and txtPassword) you would use something like this:

Page_Load(object p_sender, EventArgs p_args)
{
  if (Request.Querystring["userid"] != null)
  {
    string username, password;
   
    GetUsernameAndPasswordForUser(Request.QueryString["userid"], out username, out password);

    txtUsername.Text = username;
    txtPassword.Text = password;
  }
}

Now if you want to press the submit button (lets says its called cmdLogin) then it depends when you would like it to be pressed. You could simulate the button being pressed in code behind by calling the event handler for the click event:

  cmdLogin_Click(null, EventArgs.Empty);

Or if you wanted to show the user the page and then press the button you would need to use some javascript (I don't know off the top of my head how you would do this).

But if all of this is to automatically log someone on from an email, you may just find it easier to have a page that accepts some sort of user identity token, and then invoke the same authentication routines that your login page uses (say FormsAuthentication), and skip the whole populating the login page controls.
0
tinhlahanCommented:
Ex: You can link complete http://localhost/myweb/complete.aspx?id=exid
exid in the database ,
http://localhost/myweb/complete.aspx is string complete page complete
when you send emai complete for user, you can send string complete + exid in database, and when user try it, it rollback and tick in database, signal complete.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.