Last post Aug 25, 2016 09:13 AM by PatriceSc
Aug 25, 2016 08:22 AMfirstname.lastname@example.org|LINK
how to know user request goes to which server if we have multiple web front end servers in asp.net
we deployed asp.net application in iis 8.5 and users access this application from load balncer from out side the network this is internet based application.
Aug 25, 2016 08:50 AM|PatriceSc|LINK
Try https://msdn.microsoft.com/en-us/library/system.environment.machinename(v=vs.110).aspx which will give the name of the server on which your code runs.
Aug 25, 2016 08:54 AMemail@example.com|LINK
how can i use this in a aspx page?
Aug 25, 2016 09:13 AM|PatriceSc|LINK
There is nothing special about this. It is just a string that you could use as any other string. For example you could do something such as :
MyLabel.Text="Your request is handled by the " + System.Environment.MachineName + " server.";
though you usually avoid to disclose this kind of information to users. My understanding was that maybe you wanted to add that to custom internal error messages so that you know on which server to look at, if you have a problem.
Or maybe should you explain what you want to do with this information or what is your actual goal? (is this even what you really need?)