Home > ASP.NET > Request.ApplicationPath is not working

Request.ApplicationPath is not working

Sometime Request.ApplicationPath  does not work with all browser properly  , so use this.Request.Url.GetLeftPart(UriPartial.Authority) instead.

Lets get it by example:

If we use Request.ApplicationPath

window.open(‘” + Request.ApplicationPath + “/Massimo/ProductDetails.aspx”‘);
It will be rendered as http://Massimo/ProductDetails.aspx that i do not want

If we use Request.Url.GetLeftPart(UriPartial.Authority)

then it will be rendered as  http://ServerName/Massimo/ProductDetails.aspx that is what we want.

I hope it will be helpful in your problem , if it help you ,give give Comment that make me post more solution of day to day problem occurred in our programming life.

Categories: ASP.NET Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: