|
If this ain't too late.. goto add remove components in control panel and install IIS.. then ul find it in Admin tools in control panel
|
|
|
|
|
|
Try this one.
Response.Write("" +
"'www.codeproject.com','','toolbar=no,location=no,directories=no'); " +
"<" + "/" + "script" + ">" );
Dabuskol
|
|
|
|
|
You should really consider using Page.RegisterClientScriptBlock or Page.RegisterStartupScript to write to the beginning or end of the document (the page <form> , actually), respectively. This allows you to specify a key so that the script is not written more than once (which, depending on what you do, can lead to script errors). This is especially handy when designing controls that need to generate script in their containing page and you can't be sure just how many a user might add to their page.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you. I tried to use the Page.RegisterClientScriptBlock or Page.RegisterStartupScript and it works the same. I changed my codes already.
/Dabuskol
|
|
|
|
|
It doesn't actually work the same in that you can key a particular script block so that it only gets written once. If you simply use Response.Write (or something similar) than you'll have trouble knowing programmatically if you already wrote it, especially when your controls are contained within a page.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi folks,
Do u guys know how to write a piece of code to check if a user has full access to a shared directory?
Thanks a bunch,
|
|
|
|
|
The simplest way is to just try to write to the directory. Checking the actual access control list (ACL) isn't necessary and does add complexity to your code. And until .NET 2.0 adds easy object-oriented support for ACLs, either you have to rely on what few (rather bad, IMO) implementations exist for .NET 1.0 or 1.1 or write your own.
A simple example follows:
try
{
using (FileStream file = File.Create("\\computer\share\test.dat"))
{
test.WriteByte((byte)1);
}
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("You do not have the necessary access.", "Access Denied");
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have created a DotNet DLL which needs to be accessed from ASP code.
The ASP code is able to run the DLL fine on my developer machine, when i migarte the code to Acceptance Server, the Creation of my DLL is failing.
All i am using is Regasm, to register my dll (which is not Strongly Typed).
I am keeping the copy of my dll for it to access from asp code where it exists.
Any help is greatly appreciated.
|
|
|
|
|
If you mean ASP 1.0 - 3.0, then you'll need to register your assembly (which doesn't have to be strong named, but it's highly recommended) with the /codebase switch to register the path to the DLL. You do not use this switch when the assembly is placed in the GAC (which requires that your assembly is strong named).
regasm.exe /codebase myAssembly.dll In ASP make sure you always use the prog id (ex: "MyNamespace.MyClass") unless you followed the guidelines for proper COM interoperability. See my blog for details: http://blogs.msdn.com/heaths/archive/2005/03/09/391358.aspx[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a program that has the basic webBrowser funtion.
im trying to give it the abilty of tab browsing throught the button to add new tab. i.m having troble with the name of the new broswer object. i call it tempWebBrowser when i create it then change the name to webBrowser and the number of the tab it is on. the problem is i can not get it to do anything as the name doesnt exist in the code to get it to navigate. is there away of saftly creating a controll in runtime and being able to use it in the code.
here is the code im using to create the tab and the new webBrowser.
private void newTabToolStripButton_Click(object sender, EventArgs e)<br />
{<br />
TabPage tempTabpage1 = new TabPage();<br />
int i = tabControl1.TabCount;<br />
<br />
WebBrowser tempWebBrowser = new WebBrowser();<br />
tempWebBrowser.Name = "webBrowser" + (i + 1);<br />
tempWebBrowser.Dock = DockStyle.Fill;<br />
tempTabpage1.Name = "tabPage" + (i + 1);<br />
tempTabpage1.Text = "tabPage" + (i + 1);<br />
tempTabpage1.Controls.Add(tempWebBrowser);<br />
tabControl1.TabPages.Add(tempTabpage1);<br />
tempWebBrowser.Navigate("www.google.com");<br />
MessageBox.Show(tempWebBrowser.Name);<br />
}
any help on how i can create the new webBroswer objects and then code the go button to work for them.
|
|
|
|
|
The variable name and the value of the Name property have nothing to do with each other, actually. The local variable name is simply a reference, so the following code would create 5 WebBrowser instances with different names:
WebBrowser webBrowser = null;
for (int i = 0; i < 5; i++)
{
webBrowser = new WebBrowser();
webBrowser.Name = "webBrowser" + i.ToString();
Controls.Add(webBrowser);
} What you have to do when trying to reference a specific WebBrowser is find it by name:
WebBrowser FindBrowser(string name)
{
foreach (Control c in Controls)
{
WebBrowser webBrowser = c as WebBrowser;
if (webBrowser != null && string.Compare(webBrowser.Name, name, true) == 1)
return webBrowser;
}
return null;
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you for the advise, i will try and use this in my program to fix the problem.
Thanks,
|
|
|
|
|
Hi!
I'm currently having a little trouble with calling the Windows XP photo printing wizard. I found this VB.NET code on the web, but when I port it to C# it tells me that vector has no add method
'create the vector COM object
Dim vector As Object = CreateObject("WIA.Vector")
' add files to the vector object
For Each file As String In files
vector.Add(file)
Next
' create the common dialog COM object, and
' display the photo print wizard
Dim dialog As Object = CreateObject("WIA.CommonDialog")
dialog.ShowPhotoPrintingWizard(vector)
vector = Nothing
dialog = Nothing
|
|
|
|
|
The .Add() method of the WIA.Vector object takes 2 parameters, a Variant and an optional Index. C# doesn't support optional parameters, so you'll have to include one in your call to .Add() . The default value for Index, according to the documentation for WIA.Vector, is 0, so:
vector.Add(file, 0);
should work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The problem ist that the compiler doesn't even treat the vector object correctly - it tells me that it doesn't contain a definition for the method add() (the same goes for dlg and method ShowPhotoPrintingWizard())
Here's my code:
// create the vector COM object
Type vProgID = Type.GetType("WIA.Vector");
object vector = Activator.CreateInstance(vProgID);
// add the paths of our photos to the vector
foreach(Photo.Photo p in _Photos)
vector.Add(p.Path, 0);
// create and display the COM printing dialog
Type dlgProgID = Type.GetType("WIA.CommonDialog");
object dlg = Activator.CreateInstance(dlgProgID);
dlg.ShowPhotoPrintingWizard(vector);
|
|
|
|
|
How about scrapping the Activator code and just adding a Reference to the Micrsoft Windows Image Acquisition Libary 2.0 and changing the code:
WIA.Vector vector = new WIA.VectorClass();
foreach(Photo.Photo p in _Photos)
vector.Add(p.Path, 0);
WIA.CommonDialog dlg = new WIA.CommonDialogClass();
dlg.ShowPhotoPrintingWizard(vector);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
vector in your code is actually an object . In order to call the Add method you must do so with vector cast to the correct type. Inheritence rules do not mean that you can call a method on an object that does not actually define that method, and System.Object (or simply object in C#) does not define an Add method so the compiler is correct.
Dave's suggestion will work, but you can also use reflection to get the MethodInfo for the Add method and invoke it:
Type vectorType = Type.GetType("WIA.Vector, Interop.WIA");
object vector = Activator.CreateInstance(vectorType);
MethodInfo addMethod = vectorType.GetMethod("Add");
if (addMethod != null)
addMethod.Invoke(vector, new object[] {p.Path, 0});
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
It still is not working. For some reason the addMethod is always null.
|
|
|
|
|
You should actually use the following snippet, but please read the documentation[^] for Type.GetMethod to better understand why:
MethodInfo addMethod = vectorType.GetMethod("Add", new Type[] {p.Path.GetType(), typeof(int)}); I'm making an assumption that the second parameter in your example is an int (System.Int32 ). Replace appropriate if I'm mistaken.
See Type.GetMethod(String, Type[])[^] specifically for the documentation for the method used above.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I forgot to add that I have to retrieve the type with Type vectorType = Type.GetTypeFromProgID("WIA.Vector");, simply Type.GetType will again return a null object.
|
|
|
|
|
You have to specify the assembly as I did in my example. A type is defined by it's namespace and class, the assembly it's defined in, the culture (only relevent for satellite assemblies), and the public key (if signed, and you should really sign your assemblies).
You don't want to use Type.GetTypeFromProgID , which gets a type from a COM server. Please see my example again, where I use "WIA.Vector, Interop.WIA". Replace "Interop.WIA" with the assembly file name (minus the ".dll") that you generated.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
The problem is that the dll I have to reference was not created by myself (in fact it is C:\Windows\System32\wiaaut.dll), actually it is not even a .NET assembly. Since I'm a newbie to .NET and COM interop I have a few problems with referencing wiaaut.dll. Could you please explain me how I obtain a reference to it?
|
|
|
|
|
In the Solution Explorer on the right wide of the IDE, you'll find a folder in your project called, oddly enough, References. Right-click it and pick Add a reference. A dialog comes up with three tabs acrossed the top, click on COM. Scroll down the list until you find "Microsoft Windows Image Acquisition Library 2.0" (assuming WinXP) and double-click it, then click OK.
Now, you'll still run into a problem with pasing the parameters into the methods because the Add method doesn't take a string type, but a COM Variant type, or Object. I'd follow Heath's advice and read up on his documentation links. Heath is the best guy in the Forums (IMHO), particullary when it comes to COM Interop.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I do know that way , but what I was thinking of was creating a reference at runtime, since I want my application to be able to work on systems older than XP as well. Since e.g. Win98 doesn't have WIA support the startup of the entire program would fail, if I add a reference at runtime, only the printing will fail.
|
|
|
|