Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

login.aspx email link syntax?

Posted on 2006-04-14
10
Medium Priority
?
622 Views
Last Modified: 2010-05-18
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?
0
Comment
Question by:kvnsdr
  • 5
  • 4
10 Comments
 
LVL 2

Expert Comment

by:asdavey
ID: 16458937
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
 
LVL 1

Author Comment

by:kvnsdr
ID: 16459876
Q. Do you know of any 'How-to' resouces so I may implement this on my web site?
0
 
LVL 2

Expert Comment

by:asdavey
ID: 16466276
Is the end goal here to implement some form of email validation?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:kvnsdr
ID: 16470207
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
 
LVL 2

Expert Comment

by:asdavey
ID: 16474022
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
 
LVL 1

Author Comment

by:kvnsdr
ID: 16474255
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
 
LVL 2

Expert Comment

by:asdavey
ID: 16474297
:-$

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
 
LVL 1

Author Comment

by:kvnsdr
ID: 16474638
Yes and if possible "Post" so the click is done as well.
0
 
LVL 2

Expert Comment

by:asdavey
ID: 16475022
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
 
LVL 1

Accepted Solution

by:
tinhlahan earned 750 total points
ID: 16476682
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Integration Management Part 2
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question