Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

erorr in global.asax content

Status
Not open for further replies.

neomax

Programmer
Jul 1, 2006
29
BG
hi, that global.asax is for authentication aspx page, but compiler return erorr, please check it
<%@ Application Language="C#" %>

using System.Security.Principal;
using System.Web.Security;

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
//Fires upon attempting to authenticate the use
if (!(HttpContext.Current.User == null))
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity.GetType() == typeof(FormsIdentity))
{
FormsIdentity fi = (FormsIdentity) HttpContext.Current.User.Identity;
FormsAuthenticationTicket fat = fi.Ticket;

String[] astrRoles = fat.UserData.Split('|');
HttpContext.Current.User = new GenericPrincipal(fi, astrRoles);
}
}
}
}



Parser Error Message: The content in the application file is not valid.

Source Error:


Line 1: <%@ Application Language="C#" %>
Line 2:
Line 3: using System.Security.Principal;
Line 4: using System.Web.Security;
Line 5:

 
I think you need to put the using statements into directives and wrap all the actual code in script tags
Code:
<%@ Import Namespace="System.Security.Principal" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

    protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{

   //etc

</script>

[blue]_______________________________________[/blue]
Business Logic:"AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle AND..." - Dr. Suess
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top