| | |
error in asp.net in </authorization>
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2007
Posts: 7
Reputation:
Solved Threads: 0
i am geting error- Requested Url: /test2/default.aspx and Description: HTTP 404 on page <--->agter login page (clivk button) it is not reaching at same page. my webpagename is-> webform1.aspx . can any body solve this problem plz
i am using this code in button click
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ValidateUser(TextBox1.Text, TextBox2.Text) Then
FormsAuthentication.Initialize()
Dim strRole As String = AssignRoles(txtUsername.Text)
Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1.0, TextBox1.Text, DateTime.Now, DateTime.Now.AddMinutes(20), True, strRole, FormsAuthentication.FormsCookiePath)
Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)))
Response.Redirect(FormsAuthentication.GetRedirectUrl(TextBox1.Text, False))
Else
Response.Write("test")
End If
End Sub
Private Function assignroles(ByVal assign As String) As String
If TextBox1.Text = "arun" Then
Return "bigboss"
Else
Return String.Empty
End If
End Function
and in global.axac coading is
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
If Not (HttpContext.Current.User Is Nothing) Then
If HttpContext.Current.User.Identity.IsAuthenticated Then
If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then
Dim fi As FormsIdentity = CType(HttpContext.Current.User.Identity, FormsIdentity)
Dim fat As FormsAuthenticationTicket = fi.Ticket
Dim astrRoles As String() = fat.UserData.Split("|"c)
HttpContext.Current.User = New GenericPrincipal(fi, astrRoles)
End If
End If
End If
End Sub
and in web.config file coading
<authentication mode="Forms">
<forms name=".arun" loginUrl="WebForm1.aspx" protection="All" timeout="60" path="c:/documents and settings/vinay/cookies"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
and blow of caading before </configuration>
<location path="test2/login.aspx">
<system.web>
<authorization>
<allow users="arun"/>
<allow roles="bigboss"/>
</authorization>
</system.web>
</location>
i am using this code in button click
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ValidateUser(TextBox1.Text, TextBox2.Text) Then
FormsAuthentication.Initialize()
Dim strRole As String = AssignRoles(txtUsername.Text)
Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1.0, TextBox1.Text, DateTime.Now, DateTime.Now.AddMinutes(20), True, strRole, FormsAuthentication.FormsCookiePath)
Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)))
Response.Redirect(FormsAuthentication.GetRedirectUrl(TextBox1.Text, False))
Else
Response.Write("test")
End If
End Sub
Private Function assignroles(ByVal assign As String) As String
If TextBox1.Text = "arun" Then
Return "bigboss"
Else
Return String.Empty
End If
End Function
and in global.axac coading is
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
If Not (HttpContext.Current.User Is Nothing) Then
If HttpContext.Current.User.Identity.IsAuthenticated Then
If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then
Dim fi As FormsIdentity = CType(HttpContext.Current.User.Identity, FormsIdentity)
Dim fat As FormsAuthenticationTicket = fi.Ticket
Dim astrRoles As String() = fat.UserData.Split("|"c)
HttpContext.Current.User = New GenericPrincipal(fi, astrRoles)
End If
End If
End If
End Sub
and in web.config file coading
<authentication mode="Forms">
<forms name=".arun" loginUrl="WebForm1.aspx" protection="All" timeout="60" path="c:/documents and settings/vinay/cookies"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
and blow of caading before </configuration>
<location path="test2/login.aspx">
<system.web>
<authorization>
<allow users="arun"/>
<allow roles="bigboss"/>
</authorization>
</system.web>
</location>
![]() |
Similar Threads
- IIS .NET2 virtual directory not working (ASP.NET)
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Why app is looking for "Default.aspx" (ASP.NET)
- Login used to work (ASP.NET)
- Forms authorization, only want a few links (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: How To Authenticate Clients to printing From Server Using ASP.NET C#
- Next Thread: image zoom
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class compatible confirmationcodegeneration content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv forms gridview gudi homeedition iis javascript jquery list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xml xsl





