R00T CaUsE
-
Adding
<authorization>
tag with the code shown in above question would make any anonymous user from accessing any page other than Login, as each request will be redirected to LogIn Page with no other content allowed from server including basic CSS.
-
Suggested solution 1 on the web was to add
<location>
tag which works for css but causes issue with the System.Linq.
Here is the solution for the StUpIdItY. First of since nothing was working I saved web.config contents and deleted web.config and recreated from scratch as follows.
Step1
<?xml version="1.0"?>
<configuration>
<system.web >
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms" >
<forms loginUrl="~/Login/frmLogin.aspx" />
</authentication>
<authorization >
<deny users="?" />
</authorization>
</system.web>
This first step took Linq errors away.
Step 2
Problem with this approach is since I am using external CSS file it will not apply to LOGIN page as
<authorization >
<deny users="?" />
</authorization>
will block any anon user.
You can still use CSS by having css in separate folder and adding another web.config file under the folder where your external CSS is. In my case my css file was, StyleSheet.css under Styles folder. So I just added web.config there as follows.
<?xml version="1.0"?>
<configuration>
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</configuration>
Now my css is working fine, as well as I can use LogIn page and Linq.
Thanks to MICROSOFT for wasting my time on these issues but I hope I can save frustrations to many in the future.
solved The type or namespace name ‘Linq’ does not exist in the namespace ‘System’ (are you missing an assembly reference?) [closed]