[Mono-list] web.config

gbisogno@tutopia.com gbisogno@tutopia.com
Mon, 02 Feb 2004 08:18:31 -0500


Hello,&nbsp;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have a problem using web.config with mono.<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; My code in web.config:<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT color=#0000ff size=2>&lt;</FONT><FONT color=#800000 size=2>authentication</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>mode</FONT><FONT color=#0000ff size=2>="Forms"&gt;</FONT><FONT size=2> 
<P></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</FONT><FONT color=#800000 size=2>forms</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>name</FONT><FONT color=#0000ff size=2>="login"</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>loginUrl</FONT><FONT color=#0000ff size=2>="Login.aspx"</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#0000ff size=2>/&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</FONT><FONT color=#800000 size=2>authentication</FONT><FONT color=#0000ff size=2>&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</FONT><FONT color=#800000 size=2>authorization</FONT><FONT color=#0000ff size=2>&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</FONT><FONT color=#800000 size=2>deny</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>users</FONT><FONT color=#0000ff size=2>="?"/&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</FONT><FONT color=#800000 size=2>authorization</FONT><FONT color=#0000ff size=2>&gt;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have&nbsp;Login.aspx and WebForm1.aspx&nbsp;page created, my Global.asax.cs file contend the following code:<BR>
<BR>
<FONT size=2></P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.Collections;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.ComponentModel;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.Web;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.Web.SessionState;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.Security.Principal;</FONT></P></FONT><FONT color=#0000ff size=2>
<P>using</FONT><FONT size=2><FONT color=#000000> System.Web.Security;</FONT></P>
<P>&nbsp;</P></FONT><FONT color=#0000ff size=2>
<P>namespace</FONT><FONT size=2><FONT color=#000000> Prueba </FONT></P>
<P>{</P>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2>&lt;summary&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> Summary description for Global.</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2>&lt;/summary&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>class</FONT><FONT size=2> Global : System.Web.HttpApplication</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> Global()</P>
<P>{</P>
<P>InitializeComponent();</P>
<P>} </P>
<P></P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_AuthenticateRequest(Object sender, EventArgs e)</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2>//Fires upon attempting to authenticate the use</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!(HttpContext.Current.User == </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>))</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (HttpContext.Current.User.Identity.IsAuthenticated)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (HttpContext.Current.User.Identity.GetType() == </FONT><FONT color=#0000ff size=2>typeof</FONT><FONT size=2>(FormsIdentity))</P>
<P>{</P>
<P>FormsIdentity fi = (FormsIdentity) HttpContext.Current.User.Identity;</P>
<P>FormsAuthenticationTicket fat = fi.Ticket;</P>
<P>String[] astrRoles = fat.UserData.Split('|');</P>
<P>HttpContext.Current.User = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> GenericPrincipal(fi, astrRoles);</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_Start(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Session_Start(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_BeginRequest(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_EndRequest(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_Error(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Session_End(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> Application_End(Object sender, EventArgs e)</P>
<P>{</P>
<P>}</P>
<P></P></FONT><FONT color=#0000ff size=2>
<P>#region</FONT><FONT size=2><FONT color=#000000> Web Form Designer generated code</FONT></P>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2>&lt;summary&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> Required method for Designer support - do not modify</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> the contents of this method with the code editor.</P></FONT><FONT size=2>
<P></FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2>&lt;/summary&gt;</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> InitializeComponent()</P>
<P>{ </P>
<P>}</P></FONT><FONT color=#0000ff size=2>
<P>#endregion</P></FONT><FONT size=2>
<P>}</P>
<P>}</P>
<P></FONT></FONT><FONT size=2>But Does Not Work.<BR>
The Login.aspx page canīt&nbsp;view&nbsp;and WebForm1.aspx is acceded directly.<BR>
<BR>
Please Help Me.<BR>
<BR>
Very Thanks.<BR>
<BR>
Mono is a great project.<BR>
</FONT></P></FONT><BR>