Click here to Skip to main content
Sign Up to vote bad
good
Hi,
 
In my web application, using form authentication. First loading login page(Login.aspx) after successful login redirect to Default.aspx form. In default page list all menus, clicking on menu the page load inside default page(Using Telerik control).
Now i am facing a issue, While user typing a direct url (Suppose one of the page name is page1.aspx) eg: Myapplication/page1.aspx the page is loading i want to restrict this.
 
Please suggest a solution for this.
Posted 8 Nov '12 - 2:54


2 solutions

You can do all this in web.config with the location tag:
 
 <location path="Page1.aspx" allowoverride="false">
    <system.web>
      <authorization>
        <deny users="?" roles="TEMP" />
        <allow roles="ADMIN, USERS" />
      </authorization>
    </system.web>
  </location>
 

Please see the following links for details:
 
https://wiki.asp.net/page.aspx/653/aspnet-webconfig--location-and-authroization-tags/[^]
 
ASP.NET Membership - Part 1[^]
  Permalink  
Comments
shanalalkasim - 8 Nov '12 - 9:23
the user accessing direct url(Myapplication/page1.aspx) after successful login so authorization is not work
jim lahey - 8 Nov '12 - 9:25
that's how it's supposed to work isn't it? If a user logs in he or she has access to stuff that anonymous users don't..
shanalalkasim - 8 Nov '12 - 10:01
user can access that page through Default page not directly
jim lahey - 8 Nov '12 - 10:04
What do you mean?
shanalalkasim - 8 Nov '12 - 10:14
In default page list all menus, clicking on menu the page load inside default page(Using Telerik control). suppose user clicking on page1.aspx menu then that page will loading inside default.aspx (The browser url is Myapplication/Default.aspx this url is not changing, user clicking next menu then that page will load inside default page). my issue is while user type any direct url(Except Myapplication/Default.aspx or Myapplication/Login.aspx) then that url will be redirect to Myapplication/Default.aspx
jim lahey - 8 Nov '12 - 10:16
What kind of Telerik control?
shanalalkasim - 9 Nov '12 - 0:05
Please refer this demo url http://demos.telerik.com/aspnet-ajax/window/examples/radwindowandmdi/defaultcs.aspx
search and study "sassion variables" and site master (optional)
 
when logging in, use as session variable for storing login info,
 
every page or your master page must check for the that variable in session, if it is okay, it lets the user to load page, otherwise it redirects it to login page
 
in login page:
 
Session.add("myvarableName", "Value")
 
in master page, or in every page load
c#
if (Session["myvariableName"]!=Null & Session["myvariable"]!= "value") Response.Redirect("Login.aspx",true);
 
vb .net
 
if Session("myvariableName") isnot nothing and Session("myvariable") = "value"
Response.Redirect("Login.aspx",true)
end if
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 545
1 Maciej Los 270
2 Slacker007 240
3 OriginalGriff 235
4 Aarti Meswania 185
0 Sergey Alexandrovich Kryukov 8,953
1 OriginalGriff 7,134
2 CPallini 3,758
3 Rohan Leuva 3,066
4 Maciej Los 2,528


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid