C# - Hiding Controls As A Form Of Web Security?

Jan 18, 2010

I am working on a website (developed in ASP.NET with C#) that was passed on to me. As I'm working through the site, I notice much of the site has this type of code in it:

EmailLabel.Visible = false;
WhateverButton.Visible = false;
AnotherControl.Visible = false;
...

This is all typically done in the code-behind of the site (in the Page_Load method). Essentially, this was put in place to prevent a non-logged in user from accessing components (the rule for the site is that a non-logged in user shouldn't be able to see any part of the site until they log in). The way above works...but it seems rather expensive to have to always check if the user is logged in and then flip to the correct status for all those components.Is there a different way that this problem could be approached. Just from thinking about it/research, I thought perhaps there would be a way that I could do a redirect back to the home page if a user is not logged in. Even further, I could extend a base page which would do this for any page that extends the base page. However, my knowledge in this area is limited, so my suggestion may not work.

View 3 Replies


Similar Messages:

Web Forms :: Hiding Buttons On Web Form Using PrincipalPolicy?

Feb 10, 2011

I want to hide a few buttons on my web form using PrincipalPolicy. My applicaiton is on the webserver. When i run the first bit of code it retruns NT AUTHORITY/NETWORK SERVICE when i run the second bit it returns myWindowsDomainwindowsUsername. Why do these bring back different values? I would assume they would be the same..

[Code]....

View 1 Replies

Hiding All Panels On A Web Content Form Within A Master Page

May 7, 2010

I'm trying to hide all panels on a page, when a button click occurs.

This is on a web content form, within a master page.

The contentplageholder is named: MainContent

So I have:

foreach (Control c in Page.Form.FindControl("MainContent").Controls) {
if (c is Panel) {
c.Visible = false;
}
}

This never find any panels. The panels are within an Update Panel, and I tried

foreach(Control c in updatePanel.Controls) { }

and this didn't work either. I also tried :

foreach(Control c in Page.Controls) { }

and that didn't work either.

View 2 Replies

C# - Document.form[0] Is Null Or Not An Object Error When Hiding A Text Field

Apr 15, 2010

I am hiding a TextBoxin my aspx page like this: myField.visible=false; Now I have a DropDown as well which tries to access the TextBox on IndexChange. The problem is, it cant access the hiffen TextBox and I am getting document.form[0] is Null or Not an Object. How can I solve that? Is the some check for that in JavaScript?

View 1 Replies

Security :: Hiding Menu Items With Role?

Oct 20, 2010

I have been trying to figure this out for a couple days, but am getting really confused on the many different posts/articles I have read.

I am trying to hide certain menu items based on the users role.

I have a Menu and a SiteMapDataSource on a master page:

[Code]....

View 2 Replies

Security :: Hiding Site Map Nodes From Master Page Dynamically?

Jul 30, 2010

I have a Master Page and on the Master Page I have a Site Map. What I would like to do is when a user logs on deending on the users permission I want to hide some of the Nodes on the Site Map.

View 2 Replies

Hiding A Page From Search Engines Like Google (like Facebook's Security Settings)

Dec 27, 2010

I am using asp.net 2010, and I would like to know how can I go about completely hiding a particular page from search engines, similar to how Facebook's security settings are set (for example, if I search for my real name, my fb page will now show up in google).

View 3 Replies

Security :: Hiding Password Protected Text In Almost All Kind Of Images Without Disturbing Its View?

Mar 25, 2010

i just want simple mechanism to make images update at my website copyright protected, so i want to protect them witht the password. any of the techinque will do , i just want the iamges to be password protected so that i can dignose whether the uploaded image is not from my site.

View 3 Replies

Security :: Apply Rights In Login Form And Create User Form?

Dec 9, 2010

i have created loing form and create user form. then how to apply login rights..? i have 2 types of user. admin and normal user admin can move and use all pages while normal user can acces limited pages.

View 4 Replies

Security :: Form Aunthetication / Show Admin Pages Only After Logging In A Form With Username And Password?

Jan 27, 2010

Me with C# asp.net

I want to show the admin pages only after logging in a form with username and password and also want to logout from the admin pages, if in the browser history select a admin page after logout it should not be shown

how can I do it.

View 1 Replies

Security :: How To Protect Form Controls Based On Active Directory Group

Feb 12, 2011

I have a requirement to make parts of forms (and sometimes the entire form) read-only based on the user's active-directory group. I already have integrated AD into the dynamic menu, so that users cannot view certain menu itmes based on their AD group - and this is working fine; however, now they want to get down to the control-level on the forms. The first way that comes to mind is for me to just grab the AD groups for the users and then loop through them, and write my own code to make controls read-only or enabled. Is this a good way to do it, or is there another way? Also, while we're on the topic, is there an easy way to protect an entire form, or maybe an entire panel?

View 1 Replies

Hiding Controls In FCKEditor?

Jul 9, 2010

i am using FCKEditor but i dont want all the buttons that are in the toolbar area i want only some of them is there any way to hide them using css or javascript or in any other way.

View 2 Replies

DataSource Controls :: Hiding Field In SQL?

Mar 26, 2010

is there some language to add to SQL that will hide a field?

View 5 Replies

Web Forms :: Hiding Controls On Page_Load?

Dec 1, 2010

I have a page with four panels. On page load all the panels are visible. there are radio buttons YES and NO. i have written java script such that if YES is clicked, certain panels are displayed and if NO is clicked, other panels are displayed.Now my problem is, on page load i dont want all the panels to be visible. If i use <control>.visible = flase on page load for those panels, java script is throwing error "Object Missing" when those radio buttons are clicked.

View 2 Replies

C# - Hiding / Disabling Controls When SqlDataSource Is Empty

Oct 12, 2010

I need to be able to hide or disable a multitude of items (detailsviews, gridviews) when an SqlDataSource returns no rows. So if the page is reposted and no rows are selected, all the controls would be disabled.

View 2 Replies

Web Forms :: Hiding ASP Controls On An Existing Web Page?

Oct 28, 2010

Somehow I need to hide a control on an EXISTING WEB PAGE.But the problem is, this control has code behind with VB.NET which I don't know how to read.. :( (I use C#)And this web page works as like an 'organic'. Controls are connected to all over other pages .This is the part to be not shown:

[Code]....

That uc4 prefix is defined at the top of the page:
[Code]....

Some how I need to not show LoginControl1.Here is what I tried, first I tried to disable it using:
[Code]....

I added Visible="false", BUT IT STILL SHOWS :( guessing visible="false" is ignored :(

Next I tried to delete that control from aspx page and commented out the codebehind function.THIS WORKED, but gave an error at the bottom of the page (yellow triangle error)...This is really hard for me because I am modifying a page which I did not write, nor the code is C# .

View 6 Replies

Printing Content Of A Page While Hiding Some Controls

Oct 15, 2011

On my page, I have some dropdowns along with labels above the dropdowns containing the currently selected items.I also have a grid bellow the dropdowns reflecting the resulting data corresponding to the selected dropdown values.

I need to allow the user to print the grid as well as the label controls while excluding the dropdowns from my resulting printed page.

View 1 Replies

Security :: Login Form Rejecting Valid Login With Forms Based Security And Membership Service

Jan 21, 2010

I've set up a system with forms based authentication and using the asp:Login control. When I put in an invalid password I get the approriate invalid password message. However when I put in a valid password, it does nothing...just returns to the login page again. I'm triple checked the login info. There is no error message, and the invalid attempts counter doesn't increment. When I put a break point in the Login_LoggedIn event of the Login form, it hits it, but User.Identity.IsAuthenticated is false. I'm not 100% sure it should be true at this point, as I'm pretty new to .NET but it seems kind of odd.

My user database is stored in a sqlserver 2005 db that already existed. I've added a new connection for it.In the authorization I have

<authorization>deny
users="?"/><authorization>

View 2 Replies

Security :: User Level Security - Enable And Disable Based On The User To Access Certain Form

Jun 26, 2010

i am working in asp.net and csharp, we have 10 user, but certain user only need to put dataentry. how to enable and disable based on the user to access certain form ,like add, modify view options.

View 1 Replies

Forms Data Controls :: Hiding A Listview ItemTemplate?

Jan 15, 2010

I was wondering if there is a way to hide the ItemTemplate. I am using listview and would like to hide the itemtemplate when i am inserting a new record. Im not sure how to or if it is possible to do.

View 4 Replies

Forms Data Controls :: Hiding A Column In A GridView?

Sep 23, 2010

I am having some trouble hiding a column in my GridView. For some reason when I do the following:

[Code]....

It hides the column correctly but also leaves an empty gray column at the end of my grid which is about 5px. Ideally I don't want to remove the column but hide it, but if I do remove it is it possible to remove the binded that column represents?

View 5 Replies

Forms Data Controls :: Hiding Gridview By Default?

Sep 21, 2010

I need my gridview to display no records when the user first lands on the page. Right now it's showing all records by default based on a query I've defined in a Table Adapter in my dataset.

I have 2 web controls that the user employs to filter data (or view all records). They are working fine--I just need to have the gridview show nothing by default.

View 12 Replies

Forms Data Controls :: Hiddenfield Not Hiding In Gridview?

Jul 19, 2010

<asp:TemplateField>
<ItemTemplate>
<asp:HiddenField ID="HiddenFieldTime" runat="server" Value='<%# Bind("Time") %>' Visible="False" />
</ItemTemplate>
</asp:TemplateField>

When I load the page, it shows up as a blank cell. Is there anyway to hide it completely as it looks out place?

View 3 Replies

Forms Data Controls :: Hiding A Column In Datagrid?

Jun 24, 2010

I had a datagrid and I was hiding columns. This was working fine to show just the columns I wanted.

[Code]....

And then I realised I wasn't paging the data so I ticked that on then above code no longer worked. The Count was equalling 1 with the paging ticked on. Why would that be?

I also used the classic formatting and when I sort the columns the classic formatting goes funny, how can reapply the sorting to make it look classic?

View 2 Replies

Forms Data Controls :: Footer Control Hiding?

Sep 28, 2010

I have a footer with 3 textboxes and 2 button.one of two button is hide button, which when gets clicked, suppose to hide footer along with their controls, its has the following code:

if(e.CommandName.Equals("Hide"))

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved