Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi friends

I send a mail with link in body tag like this

body += "<br /><a href = '" + Request.Url.AbsoluteUri.Replace("MaterialRequestForm.aspx", "ViewMaterialRequest.aspx?EMPID=" + txtEmployeeID.Text) + "'>Click here to view Materials</a>";

When I opened this link from toemail in my localsystem the aspx page is dispaying and working perfectly but when I am trying to open in another system the aspx page is not displaying it showing "Access denied" error.

I also tried by placing ipconfig in url like this

C#
body += &quot;&lt;br /&gt;&lt;a href = &#39;&quot; + Request.Url.AbsoluteUri.Replace(&quot;http://localhost/MaterialRequestForm.aspx&quot;, &quot;http://myipconfig/ViewMaterialRequest.aspx?EMPID=&quot; + txtEmployeeID.Text) + &quot;&#39;&gt;Click here to view Materials&lt;/a&gt;&quot;;</pre>


what my question is how to open email send link in another pc to view the aspx page after view admin may approve or reject the process in that aspx page through Lan network.

Please guide me how to acheive this.

Thanks in advance

What I have tried:

MailMessage mm = new MailMessage(strfromemailId, strtoemail);

mm.Subject = "Request";
string body = "Hello " + Name.Value + ",";
body += "

Please click the following link to view the requested Materials";
body += "
Click here to view Materials";
body += "

Thank you;
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential();
NetworkCred.UserName = strfromemailId;
NetworkCred.Password = strPwd;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
Posted
Updated 11-Sep-16 4:31am

1 solution

The page is opening properly on your system because, the application is hosted on your machine(IIS). When you are opening it on another box, that means, link will try to look at the hosted site on that machine. If it does't find(which it will never find), it will show error.

So you may like to use your local IP instead of localhost to run the site on another machine (make sure both are in same network). Better you try to open your site on other box first before opening it through from the email.

To get your IP, open cmd and the type ipconfig. Form there take the IPv4 Address. It should start with 192.168.XXX.XX or 207.
 
Share this answer
 

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