asp.net request url getleftpart problem - not adding forward slash

The code below constructs a url for a password reset method something like this

www.testwebsite.com/testapp/VerifyUser.aspx?Verify=34343r3e

It works fine locally but on the dev server

it does not add a forward slash before the verifyuser.aspx?

www.testwebsite.com/testappVerifyUser.aspx?Verify=34343r3e

I have tried every combination even hard coding the slash in but it will not add it.
I am sure it is to do with the way the IIS virtual is set - but I have not access to it

Can anyone help?
string baseURL = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;                                    
            string verifyUrl = "VerifyUser.aspx?Verify=" + VerinID.ToString();
            VeriURL = baseURL + verifyUrl;

Open in new window

mugseyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roshan DavisCommented:
try this
string baseURL = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;                                    
baseURL = baseURL.Trim();
if(baseURL[baseURL.Length - 1] != '/')
{
	baseURL += "//";
}
string verifyUrl = "VerifyUser.aspx?Verify=" + VerinID.ToString();
VeriURL = baseURL + verifyUrl;

Open in new window

0
mugseyAuthor Commented:
ok thanks I cannot try until tomorrow but if it it works locally and if the same code that I have used before works OK with a normal IIS setup then do you think it must be the IIS setup?

The url on the stage box is like this

http://publictest.devbox34.com:8080/testapp/

0
Roshan DavisCommented:
must be some setup, but safer side is making sure that slash is present or not (like I kept the slash in the above code)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

mugseyAuthor Commented:
ok thanks

Previously even if I have hard coded the slash in - it is still not present in the URL - so if I do

string verifyUrl = "/VerifyUser.aspx?Verify="fdf

the slash is taken out when it sends the URL in the email body
0
Roshan DavisCommented:
you may need to give 2 slashes in a string to display
eg.
string verifyUrl = "//VerifyUser.aspx?Verify="

or have to use @

eg.
string verifyUrl = @"/VerifyUser.aspx?Verify="
0
Roshan DavisCommented:
sorry my bad, plz ignore my previous comment, it is only for \
0
mugseyAuthor Commented:
ok i will try tomorrow and let you know friend
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.