Names Of The Private Properties Of A Public Class?
Mar 12, 2010Names of the private properties of a public class?
I have the following class
[Code]....
Names of the private properties of a public class?
I have the following class
[Code]....
I have searched high and low (and very possibly could have missed it), but in my years of programming, I have always come across one practice that seemed to be the standard in OOP, which is to use private properties in an object with public methods to manipulate the data.
However, the more I delve into ASP.NET (specifically with MVC), the more public properties I see inside of classes (specifically models) such as the ones shown at Scottgu's blog discussing the Entity Framework.
Does it have something to do with the way that LINQ populates a class?
I have like 10 private members in my class, and I was hoping vs.net could create public properties from them but can't seem to find that option in VS.NET 2008.
Is there a feature for this?
Why i can't access MasterPage's public property (MessagePlaceholder) from other Class (Errors) ?Error compiler gives me is "Error 1 The type or namespace name 'MyMasterPage' could not be found (are you missing a using directive or an assembly reference?)"my master page code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MyMasterPage : System.Web.UI.MasterPage
{
public string MessagePlaceholder
[code]...
i have websrvice class in this i declared a webmethod and a public property my problem is i want to acess service class public property in my asp.net web application after creating proxy object.
service class:
[Code]....
I have an web application that encrypts data using a public and sent it to another web application. Which will then decrypt the data using a the user private key. My question is, since but the Private and Public key are generated in the first application. how does the other application get the private?
View 2 RepliesI want to use PKI public and private encryption for authentication to allow for a more streamlined and secure application access control system. generation of certificate and authentication will be useful. One more question, can i use System.Security.Cryptography.X509Certificates class for the same?
View 1 RepliesMy site is 100% private (only public facing page is login) I've had the need to open up a page to anon via the <location> node in the web config...and that all seems to work However the issue now appears to be that dynamic resources such as the Telerik.Web.UI.WebResource.axd and imagesjavascript changed via handlers dont load. A firebug of the situation shows that for those dynamic elements, it's trying to re-direct to login to get them Is there anyway around this?
View 3 RepliesBe built an MVC application. Some of the pages require being under SSL encryption. Means the whole site need to be broken down to sections (http and https)The immediate solution that comes to my mind is creating two IIS sites (port 80 and 443) and break the application to two sites (public-http and private-https). Since the site is complex, breaking it into two applications will be huge work.What is the easiest way of doing this?Is there any link or article that explains the best practices doing this?
View 1 RepliesI can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
I know its got to be something simple but I can't seem to find the answer anywhere.
I am working with RSA Algorithm recently.
I want to use RSACryptoProvider for this purpose.
But i want to use my custom Key instead of default key
for example my public Key =(187, 7)
and my private key=(187,23)
how can i pass my public and private key at RSACryptoProvider
For example I need to create middle size internet shop with public frontend and private backend. No silverlight, only html
Is there any sense to use wcf?
If yes, what benefits I will get with wcf?
Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net
View 2 RepliesI have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.
View 9 RepliesI have some problem about keeping "Generated Public and Private Asymmetric Keys" in web.config.
At first, I generate key from external application, the result keys are in the xml files named "PublicKey.xml" and "PrivateKey.xml".
Key example,
<RSAKeyValue><Modulus>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Modulus><Exponent>AQAB</Exponent><P>3lJSXraj/fffffffffffffffff</P><Q>th/FSSSSSSSSSSSSSSSSSSSSS</Q><DP>FFFFFFFFFFFF</DP><DQ>A0SfrELG91Fz8/LmcqwlZRu7a7ZVldC1fAtsK+6M6aQ3d4dBp5coDP6wz5ah2dFrbinpVZjSjLmLXYSmTK2aYQ==</DQ>
[code]....
I want to keep above generated key in the web.config for using the other thing.
How can I keep "Generated Public and Private Asymmetric Keys" in web.config?
I have two pages page1.aspx and page2.aspx, both have code behind with partial classes. How do i access public property message on page1.aspx from page2.aspx ?
public string message { get; set; }
I have a site that allow the user to request a secret report in a pdf format. My idea is to put the generated pdf files in a public folder with disabled directory browsing. Each file name consists of 128 characters that are uniquely and cryptographically generated. The legitimate user will be given the link of his/her own report.
View 2 Replieshave a look at the code:
[Code]....
Here When i create object of Class InheritingOneConstruntor value of public field var1 is zero at last. But when i checked step by step through debugging i found that when base class's New() constructor is called, for a moment all var1's value becomes 89. All var1 means at all locations where var1 is used i.e., in base class and in child class.But the moment control exits New() constructor of base class, var1's value again becomes zero. Why it happend ?
I have the following code in a class in which I call from different pages, I wanted to know where this info is being stored at as I can see it from different pages.
[Code]....
Also, is this saved on the browser session? IIS? will whatever being set from 1 user be affected by every other user on the site?
I have a very simple user control in my web site project which has public property declarations as following
[code].....
When i drag the ascx file to one of my aspx page and when i go to code behind of aspx page i can access the controls properties through intelisense, but when i run the project through visual studio i get error "The name 'uctTest1' does not exist in the current context?
This is the line where Error shows when i run the project uctTest.StartDate = DateTime.Now;
aspx page markup :
[code]....
I'm working on a page with two sets of collapsable panels. using nHibernate) I get category objects with a list of items in them, and for each category generate a left panel and right panel. In both panels, there is a ListBox. Items are pre-populated to the left list box and the user can select and move items into the right list box (under the corresponding category.) As I've built and worked on it, I ended up with a lot of generic methods like buildPanel(side,categoryID) and then ended up with a lot of repeated if statements inside them to differentiate between the two sides
if type=PanelType.Left then
set these 5 id strings to access components
else
...
The code got messy, so I moved a lot of the logic and static builder strings for the component ids into a private helper class in order to make other parts of the main class easier to read and follow. The problem I see is that the private class is extremely dependant on specific structures in the parent class. There's a very minimal amount of encapsulation going on and I'm possibly making the logic harder to follow even if the individual components in the code are easier to read.
My question is: When you're using a private class like this, is it acceptable to have it tightly integrated with the parent class (since it's private and implemented in the same file), am I better to refactor again and find a way of either simplifying my original code to be as short as possible without the helper class (stick all category/panel functions in one spot and hide them in their own region when I'm not using them), or should I move towards putting more of the logic in the helper class and simply mapping my events directly to the subclass. After typing all this out, I'm leaning towards the last option, but I'm still torn/confused about the whole thing...
I want to retrieve private (implementation and other) methods of a class which implements an interface and also is derived from (inherits) a base class.
How can I achieve this using reflection? Is there anyother way to achieve this?
This is wat m tryin to do. I need to view these private methods and their contents, I don't want to invoke them.
Dim assembly As System.Reflection.Assembly
Dim assemblyName As String assemblyName = System.IO.Path.GetFullPath("xyz.dll")
assembly = System.Reflection.Assembly.LoadFile(assemblyName)
assembly.GetType("myClass").Getmethods(Bindings.NonPublic)
assembly.GetType("myClass").GetMethods(BindingFlags.NonPublic) isn't working
Here's the scenario: A class based on System.Web.UI.Page has been created. A number of content pages derive from this class. All of these content pages use the same master page. The content pages define controls which need to access things on the master page (in code-behind). This is fine - no problem. In particular, each content page has its own data grid. The grid on each page has the same name, so that common code can reference it. In fact, some event handling for the grids on each content page is identical, so would like to factor that code to the base class. Interestingly, I can actually define the event handler entirely in the base class, with no stub in the content class at all, because the wire-up of event handlers uses the event-handler name defined in the grid, and that name happens to be found in the inherited base class. All good and dandy... very cool in fact. The problem comes when the code in the base class needs to access any of the common elements from the content page's master. Remember, the master is the same, and I know the type of the master. I would like to do something like this in the base-class code:
((myMasterType)this.Master).PropertyofMaster=xxx;
The problem is, that myMasterType - the type of the master page the content pages are using - is not available at compile time, at least not from a class definition for a base page. I've found articles that claim that the class name of the master is available - and it is, but not from a separate class. I CAN see it and compile with the master's class name from, for example, the code behind of the various content pages. But the actually class simply isn't available, it seems, from a pure class (the base page class). Judging from other times this question has been asked, here are common misunderstandings offered as solutions: 1. Use a page directive to declare the master type. This is not even vaguely a part of the problem, as the issue is not code in the content page, but in a separate base class which content pages inherit from. That base class is a pure class -- no .ASPX file at all. 2. Pass a reference to the master object from the content page to the base class. This can be done, but is pointless, because I can already get it, using "this.Master" from the base class! But because the type of the master is not available at compile time from the base class, it can't be passed from the content page either - unless it is passed with type MasterPage, thus losing all the properties/methods publically defined in the specific master page class. 3. Move the base page class out of the App_Code folder because the app_code folder is compiled before the other classes, and thus before the master page class. Doesn't work -- put the master page class file right in the same folder with these content pages and their master page, and the master page class is still not available at compile time from within the class. Re-summarized: Base page inherited by content pages. Content pages all use a common master page. Want to access the public properties of that master page from the base page, at runtime. Barrier is that I can find no way from within the base class to cast the master page object to the actual master page subclass being used.
I'm embarrassed to ask this here because it's clearly been duplicated several times already on StackOverflow. I've read a lot of stuff including:
[URL]
I think I've done exactly what those article say, but it's not working for me.
Here's the top of my master page, named "MasterNoNews.master":
[code]....
In the first case, VS is telling me System.Web.Ui.MasterPage does not contain a definition for urrentUser. In the second case, VS says the type or namespace 'MasterNoNews' could not be found.
I am part of a team that is developing a SharePoint web part. My task is to create a user control which will ultimately be wrapped in another class for presentation in a web part. Because of these requirements, I must fit all of my code in a single user control.To organize my code in the code-behind, I created a few private classes for the different objects which are represented in the database. I want to add some exception handling whereby if some sort of DB exception is thrown I can update a message on the page informing the user of the problem.
My problem is that the page-level controls are inaccessible from the private class where I'm issuing the query, so even if I catch the exception I have no way of directly accessing a Label control to populate the error. I tried to create a baseclass with an EventHandler defined, but when I throw events from the private class I'm not able to catch them for whatever reason. I'm far from an OOP expert Here is a snippet:
ASP Code:
using System;
using System.Collections;
[code]....