Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
down vote favorite


I have developing one application in that I have put Demo download link of software that we are developing. Now when ever user click on demo download link first it will show one inquiry form to user then user fill this form and at time of submit that demo link will send to his/her Email id and same time his data are save in our database so the entry date and time of his registration is also save in database now i m getting error in next process. Now senario is that after 24 hours that demo link will be dis able from his/her email id means he will not download again that demo after 24 hours of his registarion now at this time that entry date and time is very help full to me so someone please provide coding means method for that in asp.net c# ..thanks
Posted
Updated 7-Apr-13 22:09pm
v2
Comments
Joezer BH 8-Apr-13 4:10am    
What seems to be the problem?
Have you tried anything?
Do you have some code to show?
pandya purvang 8-Apr-13 4:14am    
protected void btn_sub_Click(object sender, EventArgs e)
{

cn.Open();
objInquiry.Name = txt_name.Text.ToString().Trim();
objInquiry.MobileNo = txtMobileNo.Text.ToString().Trim();
objInquiry.EmailId = txt_eid.Text.ToString().Trim();
objInquiry.InquiryFor = "Agriculture Product Marketing comity System".ToString().Trim();
objInquiry.Message = txt_msg.Text.ToString().Trim();
using (DataSet ds = objInquiry.InsertInquiry())
{


Msg.Visible = true;
Msg.Text = "Thank U For Inquiry We Will Send Demo Link To Your Email Please Check Your Email Regularly";

}
try
{

MailMessage mail = new MailMessage();
mail.From = new MailAddress("abc@gmail.com");
mail.To.Add(txt_eid.Text);
mail.Subject = txtInquiryFor.Text;
mail.IsBodyHtml = true;
mail.Body = "Welcome Mr." + txt_name.Text + "<br><br>";
mail.Body += "To ShreeHans Webnology" + "<br><br>";
mail.Body += "Thank u for putting inquiry for" + txtInquiryFor.Text + "<br><br>";
mail.Body += "Please Click on Following Link To Download Your Demo" + "<br><br>";
mail.Body += "Download Demo Software";

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential("abc@gmail.com ", "******");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(mail);


}
catch (Exception ex)
{
ex.ToString();
}

}
public string RegDate(string id)
{
id = ds.Tables[0].Rows[0]["InquiryId"].ToString();
string sql = "select EntryDate from tblInquiry where InquiryId= " + id + " ";
return sql;
}
pandya purvang 8-Apr-13 4:17am    
now what can i do??
Joezer BH 8-Apr-13 4:34am    
Great, now what's missing is the link to do the download.
Do you direct to a file directly or do you direct to a page that check for credentials/date/etc and then returns the file or redirects to the file?
pandya purvang 8-Apr-13 4:37am    
actually that link is send to the user's email id and he can download it....it is file from our websites .....and after click on this user can download it....but how to disable this link after 24hours of downloading ?

1 solution

Hi Pandya,

I would set rules on DB level, maybe you want to add a field to set reg_date. and set a check in the download link page for that field!

C#
// Date reg_date = Get date from data source;

Date today = New Date();

if(reg_date > today)
{
// redirect to error page
}
else
{
// download
}


Regards,
Mishal
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900