Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

Skoder

@Skoder
About
Posts
45
Topics
23
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Creating Custom Providers
    S Skoder

    Hi, I am trying to create my own custom providers. I am using the Microsoft SQL providers as refference. What i want to do is to make a set of providers which works with my own database schema. Key points to my changes is that GUID will be replaced with an incremental Int for Primary key / Id, and i want my code to be based on the id fields instead of a username (which is currently how it works). I have read the documentation for the Membership and Profile Providers. In the Sql Profile provider from Microsoft the GetPropertyValues and SetPropertyValues methods are the central part, they both have an Input parameter of type SettingsContext which contains Username (username or userId according to documentation) and IsAuthenticated. How do I make it "contain" the UserID instead of Username ? Is there anyway to control what is in the SettingsContext collection ? As far as I see it, it will never contain the UserID (or at least i dont know how to make it contain the userid), but probably it will contain the random generated username for an anonymous user. But please let me know how to make it use the userId as mentioned in the documentation. Will I ever be able to make this work or am i better of creating something to "stand-alone" which isnt intended to be used in the provider model ? If it is not recommended to create new providers, can anyone recommend an approach to creating my own "framework" for controlling users/login and such. I was thinking of creating something very similar. Is there some way I can register a class (maybe in the webconfig) which will run when asp.net is running, like etc. the Profile provider soo i dont have to create a new instance on every page load (and get connection string and such, but which is loaded first time it starts (asp.net/iis) and then ready for use/access all the time). Is there any security issues i will need to think about ? I was wondering how the build in Membership system stores if a user is logged in or not. Is the username or userid just saved in a session variable ? I am also thinking about if i make my own framework is there any way to make it work with the existing panels or will i have to create new panels ? (for an example to determine content to show the user if the user is logged-in or not and if the user if one role or another), and what about the way you can control access to your website through the webconfig by specifying which roles have access. Is it possible to make my own "framework" work together with this ? Hope som

    ASP.NET database question tutorial csharp asp-net

  • Method Overloading Troubles
    S Skoder

    Thanks for the answer. I decided to go with the abstract solution as i could probably come in handy later on. I guess it would have worked if i used the ArrayList with the objects directly and just did something like Move(theArrayList[index]); -- hmm i am sure i once found an articel on this site about this ... hmm Best regards Martin ... :) -- modified at 22:16 Tuesday 11th April, 2006

    C# help tutorial question learning

  • Updating ListView with Thread (+ extra thread questions)
    S Skoder

    Hello, i am trying to keep updating a coloum for each ListViewItem in a ListView. I though i could just do this by a thread that kept updating every 10 secound but i can see that it is only possible to update / change / work with the ListView from the Thread that originally created it. Soo how can i achieve what i want ? Should the thread which updates the ListView instead maybe call a method like Invoke(TheMethod) every 10 seconds, or how should it be done ? Other Questions about Threads: I seem to get into 2 usuall problems. 1. I only want 1 thread to be able to be created and working on a method. I usually solve this by declaring the Thread thread globally within the class, soo before i create the Thread i check if thread == null ( create thread ), and in the code which the thread is running i then set thread == null when it exit. Is this okay ? or are there some smarter way to do it ? maybe some build in type / object or something ? 2. I only want 1 thread a time to run some code. Usually i solve this by declaring an Object threadLock globally within the class, soo i can just do lock(threadLock) { THE CODE HERE }. Any better way of doing that ? Best regards Martin :confused:

    C# question announcement

  • Method Overloading Troubles
    S Skoder

    Hey, i want to do some overloading but i cannot find out how to get the object type to be right. The problem is the following. I have a Base class called Animals, and then i have a couple of sub classes which inherit from the Animal class (etc. Dog, Cat and soo on). I Create my Dog and Cat objects and add them to an ArrayList. For controlling the ArrayList i have a couple of Methods, one of them is GetAnimal();, which will return a object from the ArrayList. But as it is different what type of objects which is returned it seems that i have to return object of type Animal (the object casted). I have a class which computes some movement and stuff. In that class i want to Get an object (GetAnimal()) and call a method, like this. public void Compute() { Move(GetAnimal()); } and then i have Move Methods for every Animal public void Move(Dog dog) { doSomething } public void Move(Cat cat) { doSomething } But my problem is that when i make the GetAnimal() call i get the object as Animal and not as the Correct type needed for overloading. Soo it complains about there is no correct method for overloading. What am i missing / doing wrong ? What should i do to get the object as the correct type which i can use when calling the overload methods I could of course place the methods on the objects and make it abstract instead, but it isnt reall what i want. Hope someone can help me with this. Best regards Martin :confused:

    C# help tutorial question learning

  • NotifyIcon Program ?
    S Skoder

    Thanks, that was just perfect and what i needed. :-) Thanks again :) Best regards Martin

    C# tools tutorial question

  • NotifyIcon Program ?
    S Skoder

    Hello, can anyone tell me how i can make a program which is only running with a NotifyIcon as the only control ? (like etc. Daemon tools if anyone know that program) Is it possible without creating a Form ? Or should I Create a Form, then put a notifyIcon on it and let it be minimized from the start (and somehow never be able to be maximized) or maybe never draw itself ? (i guess there must be some "correct" way of doing this?) Also i dont want program to be able to be selected when doing Alt+Tab etc. Anyone know how to do this ? Best regards Martin :confused:

    C# tools tutorial question

  • Menubar like Skype ... ?
    S Skoder

    Hmm ... Actually it is not only Skype that have that type of buttons ... also Internet Explorer, Outlook and more uses that type of buttons... It is just like normal buttons with a Image attached but they dont have the outline, only when the mouse moves over... I guess they are probably already a part of the .NET 2.0 Framework ... But how are they made ? what are they called ? i simply cant find out ... Can anyone help me ? What should i look for, for creating buttons like that ?

    C# question csharp wpf com tutorial

  • Menubar like Skype ... ?
    S Skoder

    Hey, i was just wondering, how do i make a menubar like the one in Skype ? (http://www.skype.com/i/screenshots/step1_windows.png[^] - The top one with icons) It seems like it is just regular buttons, they have used which gets the outline when the mouse is moved over. But i cant find out how to remove the outline from the buttons when the mouse is not over. The 3 styles i have all have a outline (standard in .Net 2.0), and doesnt look like the ones in Skype. Also is the Seperator which is used a standard item ? or is it something they have made themself ? Martin

    C# question csharp wpf com tutorial

  • Remoting - Start / Stop Server
    S Skoder

    Hey, i am trying to develop a small program taking advantage of .NET Remoting. I have a button which i want to Start and Stop the Server with. But my problem is that I cant really find any information about how to stop the Server. I simply start the Server by doing the following: RemotingConfiguration.Configure("theconfiguration.config"); But then i dont know how to stop the Server again when pushing the button. Can anyone help me ? I can see that if i instead of using a configuration file, set it all up directly in the code there is the ChannelServices.RegisterChannel and the ChannelServices.UnregisterChannel. But will this be the correct way to do it if i want to start and stop the Server ? Or will i have to etc. make a new application domain and run the server there and then destroy it when i want the Server to stop ? How should it be done ? Hope someone can help me Best regards Martin

    C# help csharp sysadmin tutorial question

  • HttpWebRequest and SSL Authentication
    S Skoder

    Hello, i am having endless problems logging-in at a website with the HttpWebRequest and SSL authentication. I have done the following: Went to the site and clicked the Lock icon in the browser which opened the certifiate window. I then Installed the certificate and after that i expored it as a .CER file I then uses this Certificate in my HttpWebRequest. this.oCertificate = X509Certificate.CreateFromCertFile("the file"<-removed full path); // doesnt complain about path As i think this will be what is called Client Authentication (only) i set the following delegate ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; // ps. the sslPolicy gives me None }; Request.ClientCertificates.Add(oCertificate); Soo then i make my request to the site and retrives the data and Request and Response headers. But there is no difference at all whether i use the Certificate or not. In my WebBrowser when using a http sniffer program it always sets the Cookie: RSP-KEY and other information in the first request to the site (both in GET and POST), but none of the information are set when i make a HttpWebRequest! What am i doing wrong ? / missing ? Hope someone can help me Martin

    C# security question cryptography help

  • GUI basics ?
    S Skoder

    Hey, do anyone know of any good basic articles about designing / creating a GUI in Visual Studio 2005 ? What i am wondering is the basic techniques for switching content and stuff like that depending on what you choose in a menu (etc.). I dont really get if you create a Panel and throw all your stuff for one MenuItem on it, and then when you choose in the menu, you just simply switch the panels ? Or how is it done ? Hope someone can help Martin :confused:

    C# csharp visual-studio help question

  • Basic Design Question
    S Skoder

    Hello, i have a (probably) very basic design question. I need to create a Person Object which holds information like Name, Email, Age, and Gender. The problem is the Gender information. There can only be "Man" and "Woman". Soo i could either create a Man and Woman object which inherits from the Person object, or i could maybe store the information as an int, boolean or maybe even better as an Enumeration ? But i cant decide which is the "correct" way to do it. The Man and Woman object will be completly identical except for their type (how they are declared - new Man() and new Woman() ..). Or should I in this case go with the other option and store the information as an int/boolean/Enum in the Person object ? And is that how it is done when you have a value than can only be a certain different set of values ? Or something completly else ? There is no really difference as far as i can see, as i will either have to do checks like - if (myObj.Gender == "Man"), or if (myObj is "Man") of course i could do some overloading of the methods soo i dont even have the if else - like HandleThis(Man obj) and HandleThis(Woman obj). Maybe for the scalability, escpecially if it had been other information i had to store which could change by time it would probably be best to go with the inhertiance example. or maybe i should always go with that solution ? To some of you this might be a stupid question, but i cant really decide. Soo i hope someone can help me to tell me what is the "correct" way to do it and why. Martin Happy New Year everyone ! :)

    C# question help design tutorial learning

  • The Connection String ? Encrypting ?
    S Skoder

    Hello, basically what i dont understand is that if the "hacker" / intruder have access to the web.config file i assume he will also have access to the .aspx files. In that case storing it in any of the 2 places (web.config file or hardcoding it in a .aspx file) wont help you at all. Even if it is encrypted it wont do any good, as you will have to store the key somewhere (dont know where it should be stored?!). Soo if the web.config file is accessible to the "hacker"/ intruder the place / file where you have stored the key for decrypting the connection string will also be accessible ? Even if you store it in a com/dll he will easily be able to pull out the connection string, as you could just look at one of the existing .aspx files and change it soo it either just writes out the connection string or if holds the key, uses the key to decrypt the connection string and then write it out. Soo my conclusion would be that if the user have access to the web.config/.aspx file(s) it doesnt matter how you choosed to store it, as you are just fucked then. Only thing encryption would do is that it would take the hacker about 30 seconds longer to get the connection string... Soo the best thing to do is to just use the intergrated security, and then the encryption of the connection string doesnt really matter as someone from the outside cant use the information to anything, and if he is inside you have problems anyway... I am probably talking a lot of nonsense ... (actually i hope soo) ... :) Soo i hope that someone could tell me how it should be done, and why my conclusion isnt right, or at least point me in the right direction. Martin :confused: Merry Christmas ... :)

    ASP.NET security com help question

  • want to know regular expression syntax?
    S Skoder

    /[a-zA-Z]*/ ? that only allows a-z and A-Z ? or maybe i didnt understand your question :)

    ASP.NET regex question

  • Extending System.Threading.Thread ?
    S Skoder

    Hey again, i just want to make a class which acts like a thread. Soo i can have private varibles, lists, methods and other stuff which is only used in that single Thread. (thats how it is done in Java). Soo i can just do something like myThread t = new myThread(var1, var2); t.Run(); it is just for because i want to seperate it. But i guess i can just do the following on the class i want to be a thread: class myThread { public myThread(var1, var2) { Thread t = new Thread(new ThreadStart(Run)); } public void Run() { bla bla bla } } It will basically work the same way.

    C# csharp java question

  • Extending System.Threading.Thread ?
    S Skoder

    Hey, thanks for the answer. Yes i found out that it was a sealed class according to msdn. But isnt there some way to make a class behave like a Thread ? Or is the only way to create instances of a Thread and pass a delegate ?

    C# csharp java question

  • Extending System.Threading.Thread ?
    S Skoder

    Hey, i just want to know how i make a class extend the Thread object ? soo the class itself acts like a Thread ? I am use to do the following in Java extend the java.lang.Thread class, and then implement java.lang.Runnable Then i could just override the Run() method, and i could create a new thread by instanciating my class like MyThreadClass tc = new MyThreadClass(); and call tc.Run() to make the thread start. But how is this done in C# .NET ? I seem to only be able to find examples which passes delegates to the Thread. Like Thread myThread = new Thread(new ThreadStart(someMethod)); Can i somehow just extend the System.Threading.Thread class ? and which interface should i Implement ? Martin :confused:

    C# csharp java question

  • Extending Membership / Profile information ?
    S Skoder

    Hello, i am using .net 2.0 and want to use the build in membership / profile option. But i am wondering how i extend the data that could be stored about an user ? Etc. i like to also store the age, country and soo on. But i cannot see any option to do something like Membership.addProperties or something like that. I dont know if i should use the Profile object, but should i then create the fields in the tables myself, and how do i make sure that the data is being added to the right member in the membership table... Also should i then first create a Member in the Membership table, and the afterwards save the other data ? ... As you can see i have a lot of questions, soo if you could give me link to a article explaning how it works and how i extend it, it would be really great. Or just give me a hint on where to look or what to search for... I think i have somewhere seen that it should actually just be added to the profile class through the webconfig file. Do anyone have any comments about the performance of the build in membership / profile option ? and if the informations are stored in the Profile object, they are only loaded when requested, not on every single refresh / page load ? Hope someone have the time to help me in the right direction :confused: Best regards Martin

    ASP.NET question csharp performance help

  • Dynamically Load Content ?
    S Skoder

    Hi, thanks for the answer. If i have 2 panel controls instead each with its own content, do you have any idea of how i apply that panel to be shown in the contentPlaceholder ? I have tried giving the contentplaceholder a ID, but i dont seem to be able to use it like myPlaceholderID.addContent() for an example... ? any ideas ? how should it be done if isPostBack addpanel1 else addpanel2 ... ?

    ASP.NET question csharp html asp-net winforms

  • Dynamically Load Content ?
    S Skoder

    Hey, i was just wondering about this very basic action. If i have a page which should show some html content if etc the site is not PostBack, and some other html content if PostBack, in old asp you could just do something like ... : <% if (foo) { %> THE HTML CONTENT <% } else { %> SOME OTHER HTML CONTENT <%}%> I know this is also possible in ASP.NET but it is probably not the correct way of doing this (or is it?). Soo how should this be handled in ASP.NET ? My best guess is that the 2 different HTML Contents could etc be put in 2 User controls and then loaded dynamically in the Codebehind. Soo it would be some thing like, .. if (foo) { load one user Control } else { load the other user control } Is it possible to do it without using user controls ? If i have to use usercontrols how do i add them to a specific contentplaceholder (i am using MasterPages asp.net 2.0) ? I havent really been able to find out how to display content dynamically in a contentplaceholder. Hope someone out there is able to help me with some of the problems Martin :confused:

    ASP.NET question csharp html asp-net winforms
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups