Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 3:54am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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 at 8-Nov-12 9:23am
   
the user accessing direct url(Myapplication/page1.aspx) after successful login so authorization is not work
jim lahey at 8-Nov-12 9:25am
   
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 at 8-Nov-12 10:01am
   
user can access that page through Default page not directly
jim lahey at 8-Nov-12 10:04am
   
What do you mean?
shanalalkasim at 8-Nov-12 10:14am
   
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 at 8-Nov-12 10:16am
   
What kind of Telerik control?
shanalalkasim at 9-Nov-12 0:05am
   
Please refer this demo url
http://demos.telerik.com/aspnet-ajax/window/examples/radwindowandmdi/defaultcs.aspx
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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  
v3

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

  Print Answers RSS
0 OriginalGriff 515
1 Maciej Los 340
2 Richard MacCutchan 265
3 BillWoodruff 225
4 Mathew Soji 155
0 OriginalGriff 8,804
1 Sergey Alexandrovich Kryukov 7,457
2 DamithSL 5,689
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100