|
I tried to add a certificate to the store using WSE (Web Service Enhancement) with the following code fragment ...
X509Certificate certFromFileOriginal = X509Certificate.CreateCertFromFile(@"C:\Keys\CertServerCA.cer");
X509CertificateStore store = X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore);
store.Open();
int certPos = store.Certificates.Add(certFromFileOriginal);
store.Close();
There was no error thrown. But the certificate did not get added to the store when I checked in the MMC. In fact it did not get added to the certificate collection of the store (which can be viewed by putting store.Certificates in the watch). However the existing certificates showed up.
I tried with store.Certificates.Insert(2, certFromFileOriginal ); and got the same problem.
.NET developer
|
|
|
|
|
my code is compiling but giving linking error when i try to print any document.
techno
|
|
|
|
|
intractive wrote:
giving linking error
And that would be? Please supply the EXACT error message, the line it's on, and the code snippet that has the problem. Using only the description you've given, which wasn't much, the problem could be caused by anything.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
How can I check if Form1.ProjectName object exist?
Is there InstanceOf method, or something like that?
Thank you.
|
|
|
|
|
You have not mentioned what the type of the ProjectName property is, but going by name I assume it is a String. Strings are nullable so you can just check it for null.
MyForm myForm = new MyForm();
if(myForm.ProjectName == null)
{
}
|
|
|
|
|
Thank you very much
I already figured that out.
Thanks
|
|
|
|
|
Hi I'm having a little problem with .NET Regex. I'm using Regex to find included javascript and CSS files in a HTML page and want to put their content directly to my page (because I'm disabling some JS methods for security).
Here's my non working code:
<br />
string html = "content of the webpage";<br />
String jsFilePattern = "(?<firstpart><script\\s* [\\w \\s = \" ' / \\. & ?]+) src=\" (?<jsurl> [\\w \\s = \" ' / \\. & ?]+) [\" '] (?<lastpart> [\\w \\s = \" ' / \\. & ?]+>) ";<br />
Regex r = new Regex(jsFilePattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnoreWhitespace);<br />
html = rReplace(html, "${firstpart} ${lastpart}" + ReadFromFile("${jsurl}"));
You don't need to debug the pattern for me because I've tested it and it works. My problem is when I call the function ReadFromFile (witch reads data from a file and returns it's contents as a string) from the Regex the content of the parameter ${jsurl} is not put in the function but the parametername instead (${jsurl}. This results in an error from my ReadFromFile funtion. It seems like Regex puts the contents of it's parameters afterwards.
Is there another way to do this?... Can I use my precious Regex pattern somehow to collect the $jsurl parts into an array or something??
Thans for reading this far
Hrannar
|
|
|
|
|
Strange pattern... You have a lot of superflous spaces in your character sets, and everywhere in the pattern. And I suppose that the set [" '] should be ["'] to only match those two characters, and not space. And shouldn't you have that set on both sides of the value for the src attribute?
Tip: You can use @ in front of strings to disable all escape sequences:
String jsFilePattern = @"(?<script\s*[\w\s=""' \.&?]+)="" src="[""'](?" [\w\s="" '="" \.&?]+)[""'](?[\w\s="" \.&?]+="">)";
Of course the Regex puts the contents of all it's parameters afterwards. It can't very well put them in there before you call the Replace method.
Use the Matches method to get a collection of matches.
---
b { font-weight: normal; }
|
|
|
|
|
I only have whitespaces for readabilty (and use RegexOptions.IgnorePatternWhitespace)
The @ symbol is a nice touch .. didn't think of that, thanks.
What I'm puzzled about is how I can extract only what I marked jsurl into the Matches collection.
|
|
|
|
|
Aha. You didn't have the IgnorePatternWhitespace flag in the code.
Use the Captures property of the match to get the captures.
---
b { font-weight: normal; }
|
|
|
|
|
Check this:
public class Params
{
private static int iParam;
public struct ParamFields
{
public string[] FieldArray;
public const int Value1 = 1;
public const int Value2 = 2;
}
public ParamFields Value(int sequenceID, int routinID)
{
//This is where some action must be carried out before I read Value1 and Value2.
//Using a structure in this way is only way to accoumplish this I think?????
return new ParamFields();
}
}
I use it like this :
------------------------------------
//assume we have Params as object oParam
console.writeline(oParam.Value(10,11).Value1))
------------------------------------
In this example Value1, Value2 is constants but they can change depening on what I pass to Value-function.
My question ... Can I retrieve Value1 by using:
-------------------------------------------------
//assume we have Params as object oParam
console.writeline(oParam.Value(10,11));
-------------------------------------------------
i.e use Value1 as default trough ToString or something else? any suggestions?
Regards // Maw
|
|
|
|
|
Let the struct inherit IConvertible, and implement it's methods. Then the struct can be automatically converted to a string.
---
b { font-weight: normal; }
|
|
|
|
|
Can you give me an example of that? I have no Idéa ... please use my little class.
//Maw
|
|
|
|
|
I was wondering if anyone knew if it was possible to insert text programmatically into a specific position in a richtextbox, that already contains text?
|
|
|
|
|
You Can Insert Text at specific posiotion by do something like that Which will insert the code after the six charachters in richtextbox
richTextBox1.SelectionStart=6;
richTextBox1.Paste();
MCAD
|
|
|
|
|
Hello,
If I have:
dataview.ListChanged += new System.ComponentModel.ListChangedEventHandler(this.dataview_ListChanged);<br />
dataview.Table.ColumnChanged += new DataColumnChangeEventHandler (this.dataview_ColumnChanged);
To unhook those event from my dataview, do I just replace the + sign with -?
Thank you
|
|
|
|
|
Yes if you want to unsubscribe to an event use -=
MCAD
|
|
|
|
|
Hello,
I have a datagrid for which I sort a column through code. I don't want the user to able to sort the columns, so I have set the
datagrid.AllowSorting = false;
When I open the form, the user can still sort the columns.
After searching the internet, I've found that if you use TableStyles that you have to set the AllowSorting property of that TableStyle to false, because it overwrites the datagrid's AllowSorting property.
But when I open the form, the user can still sort the columns.
Are there other properties to set to not allow the user to sort?
thx in advance,
kalliet
|
|
|
|
|
Figured it out!
I was on the right track (TableStyle.AllowSorting = false), but because I moved the columns I had to create a new TableStyle and I forgot (shame on me!) to copy the AllowSorting property in the new datagrid.
So for any of you who are interested :
if you use sorting on a datagrid and you use TableStyles :
set the TableStyle.AllowSorting property to the datagrid.AllowSorting property, because it overwrite the datagrid's property !!
kalliet
|
|
|
|
|
hi all,
I need to get path of MDF and LDF files of a database("stock") in SQL Server.
Can I get path of both files using C# ?
thanks in advance..
|
|
|
|
|
You can easily achieve this by using SQL DMO.
SQLServer2Class sqlServerSource = new SQLServer2Class();
SQLServer2Class sqlServerdestination = new SQLServer2Class();
//Connect to source database
sqlServerSource.LoginSecure = true;
sqlServerSource.Connect(serverName, null, null);
foreach (_Database databaseClass in sqlServerSource.Databases)
{
if (databaseClass.Name.ToLower().Trim() == databaseName.ToLower().Trim())
{
foreach (FileGroup fileGroup in databaseClass.FileGroups)
{
foreach (DBFile dbFile in fileGroup.DBFiles)
{
sourceFileNamePhysical = dbFile.PhysicalName.Trim();
}
}
break;
}
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
How create setup project in C# including the .NET Framework
Thankx
|
|
|
|
|
|
You can use Microsoft Setup and Deployment Project.
http://www.codeproject.com/dotnet/CustomizingInstallers.asp
Live Life King Size
Alomgir Miah
|
|
|
|
|
You may want to check out inno setup as I found it easier to use.
p.s. It is free!
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|