Click here to Skip to main content
15,889,879 members
Home / Discussions / C#
   

C#

 
GeneralRe: Smtp mail Pin
John Karbin27-Feb-03 21:02
John Karbin27-Feb-03 21:02 
General.net Pin
devvvy26-Feb-03 19:32
devvvy26-Feb-03 19:32 
GeneralRe: .net Pin
Hesham Amin26-Feb-03 22:07
Hesham Amin26-Feb-03 22:07 
GeneralVery hard to fix bug in my Form Pin
Mattingly26-Feb-03 13:45
Mattingly26-Feb-03 13:45 
GeneralRe: Very hard to fix bug in my Form Pin
Jeff J26-Feb-03 17:31
Jeff J26-Feb-03 17:31 
GeneralRe: Very hard to fix bug in my Form Pin
Mattingly26-Feb-03 17:44
Mattingly26-Feb-03 17:44 
GeneralRe: Very hard to fix bug in my Form Pin
Mattingly26-Feb-03 19:06
Mattingly26-Feb-03 19:06 
GeneralWebService Question Pin
codeweenie26-Feb-03 12:11
codeweenie26-Feb-03 12:11 
Can a web service write to the registry on the server hosting it?

I have the following code, it works in a windows forms application, but not in this web service. My try/catch is catching that there is an error, but I am not sure how to display what that error detail is. Second part, and I know this is simple, how do I read in a URL var into my web service? Once I get this working, it's pretty simple, it just needs to read a 4 digit number, then write a string var into the registry on the server hosting the webservice. I am trying to automate some stuff on a windows media server. Here is my code so far:

<code>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using Microsoft.Win32;

namespace wmRegEdit
{
[WebService(Namespace="http://events.activegroup.net/ws/")]
public class wmRegRead : System.Web.Services.WebService
{
[WebMethod]
public string GetRegValues()
{
RegistryKey regKey;
regKey = Registry.LocalMachine.OpenSubKey(@"Software\MyTestRegKey");
string[] valnames = regKey.GetValueNames();
string val0 = (string)regKey.GetValue(valnames[0]);
string val1 = (string)regKey.GetValue(valnames[1]);
return val0 + val1;
}

[WebMethod]
public string WriteRegValues()
{
try
{
RegistryKey regKey;
regKey = Registry.LocalMachine.CreateSubKey(@"Software\MyTestRegKey");
//regKey = Registry.LocalMachine.OpenSubKey(@"Software\MyTestRegKey");
string[] valnames = regKey.GetValueNames();
string val0 = (string)regKey.GetValue(valnames[0]);
string val1 = (string)regKey.GetValue(valnames[1]);
regKey.SetValue("Domain", (string)"WorkGroup");
Registry.LocalMachine.Flush();
return val0 + val1;
}
catch
{
return "reg write error";
}
}
}
}
</code>

Thanks,
Bill K.
GeneralRe: WebService Question Pin
David Stone26-Feb-03 12:25
sitebuilderDavid Stone26-Feb-03 12:25 
GeneralRe: WebService Question Pin
codeweenie26-Feb-03 13:28
codeweenie26-Feb-03 13:28 
GeneralRe: WebService Question Pin
David Stone27-Feb-03 7:39
sitebuilderDavid Stone27-Feb-03 7:39 
GeneralRe: WebService Question Pin
Brian Olej28-Feb-03 6:52
Brian Olej28-Feb-03 6:52 
GeneralDataTable.Select() has a problem Pin
Nicholas Naddaf26-Feb-03 10:00
Nicholas Naddaf26-Feb-03 10:00 
GeneralRe: DataTable.Select() has a problem Pin
Paul Riley26-Feb-03 16:17
Paul Riley26-Feb-03 16:17 
Generaltransparent user control - background image not lined up Pin
bwells26-Feb-03 9:23
bwells26-Feb-03 9:23 
GeneralCustom IE Toolbar w/C# Pin
C#iruzo26-Feb-03 5:59
C#iruzo26-Feb-03 5:59 
GeneralRe: Custom IE Toolbar w/C# Pin
leppie26-Feb-03 6:06
leppie26-Feb-03 6:06 
GeneralRe: Custom IE Toolbar w/C# Pin
C#iruzo26-Feb-03 6:23
C#iruzo26-Feb-03 6:23 
GeneralRe: Custom IE Toolbar w/C# Pin
leppie26-Feb-03 6:27
leppie26-Feb-03 6:27 
GeneralRe: Custom IE Toolbar w/C# Pin
Arun Bhalla5-Mar-03 7:39
Arun Bhalla5-Mar-03 7:39 
QuestionTextbox Control databinding, a bug? Pin
DionChen26-Feb-03 5:28
DionChen26-Feb-03 5:28 
QuestionIs it possible to send images in a client server application using socket programming?? Pin
dalia_azzam200326-Feb-03 4:56
dalia_azzam200326-Feb-03 4:56 
AnswerRe: Is it possible to send images in a client server application using socket programming?? Pin
Giles26-Feb-03 5:47
Giles26-Feb-03 5:47 
GeneralRe: Is it possible to send images in a client server application using socket programming?? Pin
dalia_azzam200326-Feb-03 6:42
dalia_azzam200326-Feb-03 6:42 
QuestionBeginner Question: Where's my window?? Pin
Mauritsius26-Feb-03 2:33
Mauritsius26-Feb-03 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.