If i want to use Property & Method in same class then how to use it. I want to keep separate class only for interface , not for property. Also we have tried with [OperationContract] before get ,set in Service class . it solved our issue but throws error while run a .svc file
I have a property on my Global.asax.cs class that I need to access from a business class, i.e. using HttpContext.Current. How do I do this? Global.asax.cs (in a web project)
public partial class Global : System.Web.HttpApplication { public static ProxyGenerator Generator = new ProxyGenerator(); Business class (in a separate business project) var generator = ((Sei.Osp.Web.Global)HttpContext.Current.ApplicationInstance)
This obviously doesn't work and I don't want to reference the whole web project in the business project as it will create a circular reference (the business project is already referenced in the web project)
UPDATE:
To clarify - the property I'm creating holds an instance of the Castle Dynamic Proxy Generator class. I've read that you shouldn't just create this all over the place. So I thought I'd create it in my Global.asax.cs and then just use that instance wherever I need to create a proxy class (I'm using it to do AOP) Is there a better way of doing this?
I'm having a problem with a class library I'm building. I have a class called Users and inside this class I have a property called UserInfo that is an object. Both of the classes Users and UserInfo are built using MyGenerations dOOdads. When I create an object instance of the Users class I am able to access the UserInfo property without a problem in my Windows App, however when I using the same library in a website the UserInfo property continues to return a no reference error. Like I said when running it in a WinApp I have no problems at all, I can access the UserInfo property and likewise all of UserInfo's properties. I am also having problems trying to debug the library using the website. And again I have no problems when using the WinApp. The way I've set it up is I have the Class library project open, and then I add the WinApp project and then the website project. When I set the WinApp as the startup project and run it I have no problems, I can set breakpoints and step through the code no problem. But when I set the Website as the startup project and try to debug I get a massage saying the breakpoint won't be hit. I then do what it tells me and right click on the breakpoint and set the location to allow the source to be different. This lets me hit the breakpoint, but every time I hit F10 to step I get "There is no source code available for the current location." For every step I take. This is making it really hard for me to figure out what going on with the code in the website. Sorry for the lengthy explanation. Here's the Users class, again it works great in the WinApp, just not the website.
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.
I created a Class library for WCS service (MyWCFServiceLibrary) to access data form my database. The database connection strings have been defined in Properties->Settings.settings. The endpoints are defined in the app.config. Tracing and logging is set to write to files on local server. This service is hosted by a .net web service. This webservice refrences the WCF service using MyWCFServiceLibrary.dll and MyWCFServiceLibrary.pdb. The web service is hosted in IIS. All this setup is working fine on the development environment.Now I want to deploy this in the QA environment. Since I am a newbie with WCF, I would appreciate some help on what needs to be done for deploying this on the QA server.1. Do I need to recompile the MyWCFServiceLibrary.dll after changing the connectionstring to point to QA database and tracing and loggint paths to the new server?2. Is there anything that needs to be done with end points or anything else?
I have a masterpage that contains all the javascript and inside the content control, there is a link that calls a javascript function and I want to pass the id once it's rendered differently by the server.
<asp:TextBox ID="txtstart" runat="server" Width="20%"></asp:TextBox> <a title="Pick Date from Calendar" onclick="calendarPicker('<% txtstart.ClientId %>');" href="javascript:void(0);">
However, I keep getting this error:
Property access must assign to the property or use its value.
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
I have a class (name PageBase) that is inhariting System .Web.UI .Page and all my .aspx page behind classes are inhariting this class. This way I have put some common things in PageBase class.
For showing errors I want to put showMessage funtion in PageBase as well so that I may have not put it in every page and it will easy to manage this way.
Probem is that how PageBase class will access a control which is in aspx page in its child class (child class of PageBase) .
I dont want to pass control as argument to function in parent class, is ther any other way ?
Suppose we declare and define the variable in one class let say FirstClass and we want to use that variable in another class let say SecondClass which is outside of FirstClass .how to do this?
I want to know if MaxConcurrentSessions property means that only 10 (default value) users can enter my application (active session) if I define InstanceContextMode persession or this means requested at a given time.
how to getValue of property class with this method?
public static int SQLInsert<TEntity>(TEntity obj) where TEntity : class { foreach (var item in obj.GetType().GetProperties()) { //item.GetValue(?,null); } return 1; }
I am applying css style to "body" and to a div which id is "overlay" like:
body { margin:0; [code]....
"overLay" div is inside noscript tag which renders in the browser only when javascript is disabled in the browser.My requirement is that I have to set "overflow:hidden" in the body when "overLay" div get rendered.
I have a class, let's say class Sample. Sample has unknown properties but inherits an interface ISample. Said interface includes one method which I'm trying to create. This interface has a method called getPropertyValue(object o, string PropertyName).
It returns the value of the o.PropertyName using generics (unless you have a better suggestion). How do I write it? In other words, I want to be able to pass the name (as a string) of a property and return its value. Samples in C# preferrable but VB ok and any comments or suggestions are welcome.
I have a page with a textbox. User enter the WCF Service URI and my program get the method names and the parameters. Then user enter the values and I want to dynamically call the method with passed parameter values.
how can I dynamically set the value of a property for a given object? For example: I have a method GetInfo(string name, Color favcolor) where name is string and favcolor is of System.Drawing.color type. How can I set the color attribute dynamically with user supplied value.
[Code]....
The last line is currently throwing an error
Object of type 'System.Drawing.Color' cannot be converted to type 'System.Drawing.Color'.
I have a class called Questions. This Questions has properties QuestionID and QuestionAnswer. My list of Questions has QuestionID like 2,3,4,15,12,24,22,,,, etc I need to sort this List of Questions Object based on QuestionID and store in another Questions object.
I have question about HttpContext class (http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx). This class has Responseproperty (http://msdn.microsoft.com/en-us/library/system.web.httpcontext.response.aspx). But I don't understand, why Response property hasHttpResponse return value, not HttpContext (this is HttpContext, not HttpResponse property).So, why there is:
Some strange problem have occured while developing application. Some WCF webservice returns object with date property.On client this web service is called using Jquery.ajax.Then result is parsed using json2.For date I simply use following expressions: var reMsAjax = /^/Date((d|-|.*))[/|\]$/; a = reMsAjax.exec(value); if (a) var b = a[1].split(/[-+,.]/); return new Date(b[0] ? +b[0] : 0 - +b[1]); unfortunatelly if browser timezone differs simple new Date with milliseconds not works.Time will be based on timezone.