hiboss hiboss - 1 year ago 94
ASP.NET (C#) Question

How to redirect page for unauthorized user

I having a asp.net program that i can only configure with web.config file.
Having this code below, it could help me redirect to login page.

<authentication mode="Forms">
<forms name="ZukamiLogin" path="/" loginUrl="login.aspx" protection="All" slidingExpiration="true" />
<deny users="?" />

However, when i changed the loginUrl to "login.aspx?AppID=90441b68-3515-4fdd-851a-4a2b753e5557&anonyform=2f7fbed9-3ef4-4e9d-b164-0f4b6104cf78" , it shows me error. Is there any way to redirect user to this link instead of login.aspx?

Edit :
added with image for the error
enter image description here

Answer Source

You can't have special characters ?, =, or . in tags or attributes because they are special characters in XML. You have to use their numeric character reference.



(you might want to check my typing)

This has the whole table of character references: https://www.dvteclipse.com/documentation/svlinter/How_to_use_special_characters_in_XML.3F.html#gsc.tab=0

Edit: Apparently for URLs it's better to use a different character encoding scheme (URL-encode) explained in the accepted answer here: Android: How store url in string.xml resource file?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download