Getting new Url of a page after web deployment

Posted by Jopito under ASP.NET on 1/15/2014 | Points: 10 | Views : 669 | Status : [Member] | Replies : 4
Hellow pals,i have deployed my application whereby i have a page called Registration and another one Complete Registration.in my Registration page,am sending an email link to someone so as he can be taken to the Complete Registation page.I had included the url of my locallhost but now someone cannot access it since its in my machine.Is their a way i can get the new Url after i have done deployment such that when sending email,it detects whether its running in locallhost or in the server url and adds that link to the email am sending to users?

Thanks

Mark as answer if satisfied


Responses

Posted by: Kmandapalli on: 1/15/2014 [Member] Silver | Points: 25

Up
0
Down
Hi,

You check on which it is running ie on machine or on server.
Get that name and append it to the link that you sre sending.


To get host name:
string hostName = System.Net.Dns.GetHostName();


Returns the computer name:
System.Environment.GetEnvironmentVariable("COMPUTERNAME");

Mark as answer if satisfied.....

Regards,
Shree M.

Kavya Shree Mandapalli

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: muralikrishnasurap-12704 on: 1/15/2014 [Member] Starter | Points: 25

Up
0
Down
Hi You can have setting from Web.Config file where you can set boolean value to differ whether you hosted your application in server (or) local host based on which you can send link to end user.

Best Regards
Murali Krishna.S

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 1/16/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,after using the Request.Url.AbsoluteUri method,it adds the url of current page for registration ,how can i b able to script the url to contain the link for completeRegistration only ,This is a sample link send to email below

http://localhost:89192/Staff/Register.aspx?rwndrnd=0.6363636646446373333CompleteRegistration.aspx?id=8901b88k1-81fa-8u10-m96e-892f6aea6710

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: muralikrishnasurap-12704 on: 1/16/2014 [Member] Starter | Points: 25

Up
0
Down

Login to post response