0

I have a class that just have defined url constants, let's say it is called Urls. I am trying to access a constant in that class inside of a a LoginStatus tag as follows:

<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutPageUrl= <%= Urls.logout %>  CssClass="myButton" /> 

and obviously it isn't working. I know I can hardcode the string inside of the field, but I am trying to avoid that if possible. Thanks for the insight!

1 Answer 1

1

Try this

LogoutPageUrl="<%# Urls.logout %>"

The # is used to "bind" values to server side properties whereas the = is the same as a Response.Write() which in this case will just write some text to the markup

Sign up to request clarification or add additional context in comments.

3 Comments

This is just a string constant.
Try the above with the #
Hmm, so it is compiling at least. However, now it is just redirecting to the login page, which signifies that the LoginStatus is seeing LogoutPageUrl as empty. Any ideas about that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.