I am using Forms authentication in web.config
and when I am redirecting my page to some specific pages, returnUrl gets appended automatically and system redirects to Login page. These specific pages should be opened irrespective of the fact that the user is Logged in or not.
This works fine when I debug it in Local machine but is giving such behaviors when I am deploying the build on Server.
Please help me as I am stuck badly on this.
You can have specific pages excluded from Forms Authentication like so:
<configuration>
<location path="Logon.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</configuration>
See http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx
The configuration in web.config file(s) are applied in a hierarchical way. To apply authentication settings (either allow or deny) to more than one page you can use this fact by putting a web.config file with authentication settings in a folder of your website that contains the pages that you need to secure, or another in the folder containing the pages that you don't want to secure. The web.config will apply to all pages in that folder.
Check this MSDN article: ASP.NET Configuration File Hierarchy and Inheritance.
Differences in behavior between local machine and build server imply differences in the configuration. That's one possible explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With