view raw
hiboss hiboss - 5 months ago 48
ASP.NET (C#) Question

How to redirect page for unauthorized user

I having a 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


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:

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?