[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

ASP.NET auto generating unique pages that have a lifespan

Hi Experts

I need to develope a system, where by at the start of every month, an email is sent out to every client. In that email, will exist a unique URL. The client can click on the link and go straight to a grid tool that we already have partly developed (allowing them to manipulate tracked data etc). At the end of the month, the link will no longer work and a new email will be sent. The idea is to not have the user enter a password or username, ever.

I am sure this is possible in ASP.NET. But I don't know how, 'exactly', hence asking here. I wonder if anyone has any examples of something like this already in action or some advice on how to go about developing this.

Thanks for any assistance.
0
gcz
Asked:
gcz
1 Solution
 
richard_hughesCommented:
Hello gcz

Do you know how to send the E-Mails?

Regarding the link in the emails, have a token parameter for each link which will only be valid for that month and will contain the user id etc.... On the page that the link is pointing to, have it decode the token to check the month, user id etc...

Here is some sample code which can do that:

Thanks,

Richard Hughes
int userId = 56812;
			DateTime month = DateTime.Now;
			month.AddMonths(1); // set the link to only work for next month

			// you may want to encrypt the token a bit more than this
			// see these urls for some possible ways depending on your needs:
			// http://www.codeproject.com/KB/security/DotNetCrypto.aspx
			// http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net
			string token = String.Format("UserId={0}&Date={1}", userId, month);
			token = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(token));

			string url = String.Format("https://www.myurl.com?token={0}", token);

Open in new window

0
 
gczAuthor Commented:
Many thanks, I haven't got to the stage of learning how to send the emails yet. Unfortunately, I need to start learning asp from the ground up. I've done similar in PHP before though, so imagin sending the email wont be that hard.

Your response has let me know that this is more than a managable project.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now