M
MattB
I'm migrating code that used to be repeated on several pages to a single
user control. In this control there is a repeater, and when the repeater
is bound, I add some links to it. This all worked great on the page but
now that I have moved the code to a user control (which lives in a
subdirectory in my application: /UserControls), my links which are all
generated as relative links now add that sub directory to the path. So
I'd like a link to point to www.mysite.com/mypage.aspx, but after moving
the code to a control, it now generates as:
www.mysite.com/UserControls/mypage.aspx.
I know I could just do some string manipulation to fix this but I'm
wondering if there is a more elegant way to fix this right. Like a way
to tell the control to generate the relative link correctly even if the
UserControl folder name changed or regardless of whether the application
is running in the root of IIS or within a Virtual directory.
Any ideas? Thanks!
Matt
user control. In this control there is a repeater, and when the repeater
is bound, I add some links to it. This all worked great on the page but
now that I have moved the code to a user control (which lives in a
subdirectory in my application: /UserControls), my links which are all
generated as relative links now add that sub directory to the path. So
I'd like a link to point to www.mysite.com/mypage.aspx, but after moving
the code to a control, it now generates as:
www.mysite.com/UserControls/mypage.aspx.
I know I could just do some string manipulation to fix this but I'm
wondering if there is a more elegant way to fix this right. Like a way
to tell the control to generate the relative link correctly even if the
UserControl folder name changed or regardless of whether the application
is running in the root of IIS or within a Virtual directory.
Any ideas? Thanks!
Matt