Check Session Value On Master Page For Menus Rights
Jun 14, 2012
How to correct my code... because if condition is going to false condition every time when i check the session value with admin user and agent user..
Code:
<td bgcolor="#808000" style="height: 22px">
<% If Session("S_UserName").ToString = "Admin" Then%>
<ul class="solidblockmenu"> <li> <a href="Dashboard.aspx" >Dashboard</a> </li><li> <a href="MasterUpload.aspx" >Master Upload</a> </li><li> <a href="InboxAgent.aspx" >Agent Inbox</a> </li><li> <a
[Code] ....
View 1 Replies
Similar Messages:
Sep 2, 2011
I m developing a Web Based Inventory System Using ASP.NET which have a menu containing 16 options overall. I have created a menu using <ul> <li> tags. When I open my project in browser, it shows all the 16 options even i logged in with Administrator or Purchaser or Seller or Accountant etc.
I have a form to assign the Form Access Rights to every user. For example Administrator can use all the options but Seller can use only 3 options (Sales / Sales Return / Today's Sale Report). Purchaser can use 3 options (Purchase / Purchase Returns / Today's Purchase Report) Accountant can use 2 options (Payment / Receipts) etc.How can i show the menus to the users according to the rights assigned.
View 7 Replies
Sep 28, 2010
I have a site which has restricted access. Access is controlled via session variables.
There are a lot of pages to the site so I was going to check for the session variable via the page load event in my mater page. However, on certain pages I use the session variable in that pages page load event. This throws an error when the session doesn't exist, but what I want is the master page's page load to fire first.
View 2 Replies
Sep 1, 2010
I want to create a master page for my already developed project. Since the project contains many forms it is quite difficult to include the master page in each form. Is there any possibilities to include the master page in any other simplest way
View 2 Replies
Sep 19, 2012
How to make menus on the header of master page in asp.net ...
View 1 Replies
Apr 26, 2010
I have a very interesting problem about Sessions and Master Pages. I designed a small CRM web application with master page. Users could enter their expenses with this application. I put a label on master page. If users login to this site, I changed this label text.
Label text is username. My problem is; when some users using this site at same time, usernames are conflict. For example; One client login and label which on the masterpage value is Ali. Another client login and label value is Ahmet. After that, If two clients process the same things on this site, Ahmet's label's value is changed to the value of Ali. I write it Session Id on URL. Firstly two clients take different Session ID when login to that page. When conflict occurs, two clients are the same Session Id that pages. I am using .NET Framework 3.5V. Is this ASP.NET bug ?
View 13 Replies
Jul 27, 2010
My web site will have lots of pages, too many to provide links for in the menu as shown in the form of the wizard-generated menu. One solution I'm investigating is to have a main menu where each item will pop up a submenu, like in a Windows app.
Can I use a "Menu" control in a master page to do a pop up menu? If so can you point me to an example or show me (a novice) how to do it? I.e., each item will have a controller action, so how do I connect the menu item to the action method?
View 3 Replies
Oct 22, 2010
how to get check box value from grid view content page/ master page
i am using following code to get the value of check box from grid view content page / master page but it not works properly
[code]....
View 4 Replies
Jun 10, 2010
Is there a way you can call a function, or make a file that runs before every page load. I want to be able to check if they have a valid session before showing the page.
View 4 Replies
Nov 9, 2010
I have a function that loops through the control on my page to set attributes. This works fine, except that I only want the attributes to bet set on the controls on the content page, and not on the master page. Is it possible to check where the control resides? Or to only loop through controls on the content page?
View 3 Replies
Jun 8, 2010
I'm currently writing a web app in ASP.NET MVC 1.0 (although I do have MVC 2.0 installed on my PC, so I'm not exactly restricted to 1.0) -- I've started with the standard MVC project which has your basic "Welcome to ASP.NET MVC" and shows both the [Home] tab and [About] tab in the upper-right corner. Pretty standard, right? I've added 4 new Controller classes, let's call them "Astronomer", "Biologist", "Chemist", and "Physicist". Attached to each new controller class is the [Authorize] attribute. For example, for the BiologistController.cs
[Authorize(Roles = "Biologist,Admin")]
public class BiologistController : Controller
{
public ActionResult Index() { return View(); }
}
These [Authorize] tags naturally limit which user can access different controllers depending on Roles, but I want to dynamically build a Menu at the top of my website in the Site.Master Page based on the Roles the user is a part of. So for example, if "JoeUser" was a member of Roles "Astronomer" and "Physicist", the navigation menu would say:
[Home] [Astronomer] [Physicist]
[About]
And naturally, it would not list links to "Biologist" or "Chemist" controller Index page. Or if "JohnAdmin" was a member of Role "Admin", links to all 4 controllers would show up in the navigation bar. Ok, you prolly get the idea... Now for the real question... Starting with the answer from this StackOverflow topic about Dynamic Menu building in ASP.NET, I'm trying to understand how I would fully implement this. (I'm a newbie and need a little more guidance, so please bare with me.) The answer proposes Extending the Controller class (call it "ExtController") and then have each new WhateverController inherit from ExtController.
My conclusion is that I would need to use Reflection in this ExtController Constructor to determine which Classes and Methods have [Authorize] attributes attached to them to determine the Roles. Then using a Static Dictionary, store the Roles and Controllers/Methods in key-value pairs. I imagine it something like this:
public class ExtController : Controller
{
protected static Dictionary<Type,List<string>> ControllerRolesDictionary;
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
// build list of menu items based on user's permissions, and add it to ViewData
IEnumerable<MenuItem> menu = BuildMenu();
ViewData["Menu"] = menu;
}
private IEnumerable<MenuItem> BuildMenu()
{
// Code to build a menu
SomeRoleProvider rp = new SomeRoleProvider();
foreach (var role in rp.GetRolesForUser(HttpContext.User.Identity.Name))
{
}
}
public ExtController()
{
// Use this.GetType() to determine if this Controller is already in the Dictionary
if (!ControllerRolesDictionary.ContainsKey(this.GetType()))
{
// If not, use Reflection to add List of Roles to Dictionary
// associating with Controller
}
}
}
Is this doable? If so, how do I perform Reflection in the ExtController constructor to discover the [Authorize] attribute and related Roles (if any) ALSO! Feel free to go out-of-scope on this question and suggest an alternate way of solving this "Dynamic Site.Master Menu based on Roles" problem. I'm the first to admit that this may not be the best approach.
View 2 Replies
Jun 16, 2010
some samples for designing the menus and sub menus in html with styles and hover etc
View 8 Replies
Jan 29, 2011
How do you declare a dictionary called MyDic in the master page?
I want MyDic to hold lists of objects MyObj with a date as the key so that I can write something like this: "get the list for date 1/28/2011 from MyDic" or "put this list of MyObj from 1/28/2011 in MyDic".
I'd like to declare the dictionary in the master page so that I can access it in every page.
View 3 Replies
Sep 24, 2010
in one of my page i need to display the menus & sub menus dynamically,for this i have a menu table called colleges & one more table called branchs 1] ABC
Science ArtsCommarce2] EFG mathszoology historylike thissome times the menus are 3some times they may be 4,5,6 may randommy incresesfor this i have the two table one is menu & sub-menus
View 2 Replies
May 7, 2015
select all checkbox in gridview header doesn't select all rows in the grid when it is in in content placeholder using javascript or jquery .how to resolve it.
View 1 Replies
Jun 10, 2010
Im trying to use code provide in this link below.http://www.codeproject.com/KB/aspnet/MultipleTabWindows.aspxim trying to have the below code in my master page instead of adding to each page. it works if i add to each page, but when i add to ,master page the session value for "WindowName" is always null.how can i fix this?
<script language="javascript" type="text/javascript">if(window.name != "<%=GetWindowName()%>"){ window.name = "invalidAccess"; window.open("InvalidAccess.aspx", "_self");}</script>public string GetWindowName(){ return Session["WindowName"].ToString();}
View 6 Replies
Feb 3, 2010
I am using the Forms Authentication in my application.
I have a master page and I have a default content page in the defaultUrl of the Forms Authentication. I am facing an issue: when the session expires the images and the css of the Master Page are not available.
How can I make the images available in the master page after the session expire?
View 6 Replies
Jul 6, 2010
I have a web application that contains a MasterPage and a Web.sitemap file for the navigation. I am loading the navigation into an <asp:Repeater> control and I associating it with <asp:LinkButton>; something like this:
[Code]....
I have two issues:
Setting Session Variables: I'd like to set some session variables when any menu item is clicked.Dynamic Url: Once the Session variables are set, I'd like to set the url dynamically after the Session variable is set The thing is, I'd like to use the same aspx file for two different menu items, and I'd also like to set some session variables at the time of menu selection. I am aware that I cannot use the same url when I define the url in the web.sitemap file.
View 2 Replies
Feb 27, 2011
am new for learning asp.net using c
View 2 Replies
Jun 8, 2010
In my web application, I have to load different Master pages depending on the user log-in information. When I say different, I mean not just the colors but a whole new look[including navigation options]. So I am using 2 Master pages [one of them is set as default] and depending on the user information the other page will be used.
I got it to work by storing the user information in a Session variable and applying the master page dynamically using the Page_PreInit event. But the issue is, if I hit the back
button, sometimes [yeah, only sometimes !!!] the master page is reset to the default page. Initially I thought it is a Session timeout issue. But it isn't, as some of the session variables still have data. Can anyone explain whats actually happening?
View 4 Replies
Sep 17, 2010
In database i m having Menus and SubMenus and URL Links Column. in addition i m having 1 more column that is URL Link for the above Table. Now My Requirement in a Webpage Based on the Selection mode i need to display that related URL Link Path For getting menus i taken TreeView Control now how to load a page(URL Link Column in DB) based on that selection of a Node.
Every thing should be Dynamically. and i dont want to use <iframeset> tags in ASP.NET webpage..
View 2 Replies
Sep 20, 2010
The Code Part
</head>
<body>
<script src="/c/Currency.js" type="text/javascript" ></script>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
</asp:ScriptManager>
<div id="Content">
<div class="nobg">
<div id="Top">
<div class="left">
<a href="index.html"><img src="/i/xyz.gif" alt="Dexia" /></a>
</div>
<div class="right">
<div id="tmenu">
<ul>
<li class="aboutus"><a href="/aboutus/"><img src="/i/menu/about_us.gif" alt="About Us"></a></li>
<li class="presscenter"><a href="/press_center/"><img src="/i/menu/press_center.gif" alt="Press Center"></a></li>
[code]...
View 2 Replies
Jan 17, 2010
I've come to the place where I need to add side bar menus to my page depending on userclass. I've set up the place-holders, but I was wondering what's the better way to add these.
View 3 Replies
May 7, 2015
URL.... Still there will be need of url in ajax method if i put javascript in site.master.cs . As what i have understood fromĀ that mysite.master.cs will be like this :
protected void Page_Load(object sender, EventArgs e) {
try {
if (Session["Prefix"].ToString().Trim() == "sys_admin") {
UserNameMasterLabel.Text = Session["UserName"].ToString().Trim() + " (ADMIN)";
[code]....
And site.master will be like this :
And I have to put next method in DailyLog.aspx page ? like this
System.Web.Services.WebMethod(EnableSession = true)]
public static int RefreshSession() {
HttpContext.Current.Session["Name"] = "BSD";
Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config");
SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState");
int timeout = (int)section.Timeout.TotalMinutes * 1000 * 60;
return timeout;
}
But I have several pages in my website , by doing the above story will it work for Builder.aspx ? or any other page rather than dailylog.aspx ?
View 1 Replies
Aug 2, 2010
I have a master page containing a tree and 3 dropdown lists. I am populating a context menu on right click of each node, and when clicked on any item of the context menu, it navigates to required pages.
My problem is after navigating to the required page, the selected values from the drop down lists and the selected node from the tree are getting cleared.
I can set the selected values for the dropdown lists by making some properties in master page.
But how do i maintain the selected node?
In my content page, i have got the valuepath of the right clicked node.
Or is there any other way than setting the properties in master page?
View 6 Replies