|
Hi,
I'm trying to create an application that, given a URL, will spider/crawl through all publicly viewable directories at the URL, and list all the files the contain in a listbox or grid of some sort. Does anyone know of any tutorials which cover this sort of spidering/crawling (preferably in C#)? - I looked, but I couldn't find anything of merit. If no one knows of any tutorials, I would appreciate any push in the right direction as to what classes might be needed.
Thanks,
Justin
|
|
|
|
|
Off the top of my head I don't know of any links that discuss this, but in reality if you break the problem down into smaller pieces, it really shouldn't be that difficult. You will need a mechanism to given a URL, extract the HTML content returned from the server. You would want to look into the HttpWebRequest class to do that. Once you had the content it's simply a matter of parsing, whether or not you tokenize the document or use regular expressions, that's up to you. Hopefully this should get you started.
- Nick Parker My Blog | My Articles
|
|
|
|
|
...and combine what Nick said with the SgmlReader[^] to read and help parse the HTML (HTML is an SGML grammar).
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]
|
|
|
|
|
Hello,
I built a program that reads data from an Excel Workbook and spits out Xml to be read by another program. It is written in C#, and I use Microsoft Visual Studio 2002 for development.
My question is this: where can I find information regarding the use of Microsoft's DLLs. When I compile my program, the following DLL's are placed in my program folder:
Interop.Excel.dll
Interop.Microsoft.Office.Core.dll
Interop.VBIDE.dll
I need to know if I am allowed to include these in my program, because this program is going to be sold and or licenced to people, but I obviously did not write the dll's, and I don't want Microsoft to sue me.
I also need to know what happens if someone has an older or newer version of Excel installed... will these dll's still work?
If someone could at least point me towards the answers to these questions, that would be great. Thanks!
Jeremy O
PM Logic
www.jeremyo.com
|
|
|
|
|
Yes and no. You can ship those DLLs - they do not contain any implementation. Those DLLs (assemblies) are merely RCWs (Runtime Callable Wrappers), or "interop assemblies".
The "no" part of my answer is because you're using the wrong assemblies. When possible, use the Primary Interop Assemblies (PIAs) shipped by the company (in this case, us - Microsoft). You can download the Office 2002 PIAs from http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en[^] and the Office 2003 PIAs are included with the Office 2003 System installations as "Developer Support" (or something similar).
You will have to chance your project references and your using statements, but the interfaces, classes, methods, properties, enumerations, and struct names should all remain the same.
The difference is that Office PIAs are "official" and signed with the corporate key, making it easier to support. If you download, extract, and follow the README file (or install these with Office 2003), in the future the PIAs are used automatically.
When possible, develop against the oldest typelibs (COM type libraries; they're used to generate RCWs) you can (without sacrificing functionality you need). When written correctly - and Office is - COM types are supported in future versions, only being deprecated when absolutely necessary (this is acheived, in part, by never changing published interfaces - always derive new interfaces with new methods, even when exposing .NET components to COM).
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 all!
Is it possible to change the color of Text in the Visual-Studio Editor? If it is, how can I do this? (I'm working with c#)
Any links, tutorials, tips?
Thanks in advance.
Christian
|
|
|
|
|
If you look at the object model for the EnvDTE object, you might notice the ColorableItems property/object. Read about it in your VS.NET help documentation or online in the MSDN Library[^].
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]
|
|
|
|
|
Ok, so I have a PictureBox on my form named pctInternet. It has the following code associated with it:
string imageLocation = @"C:\mypicture.jpg";<br />
Bitmap bmp = new Bitmap(imageLocation);<br />
pctInternet.Image = bmp;
Now, I just want my PictureBox to display the picture and CLOSE the actual "mypicture.jpg" file, but for some reason whenever I try to delete the "mypicture.jpg" file while my app is running, it errors and says "File is in use."
How do I fix this? What line of code am I missing?
|
|
|
|
|
Because the file is in use. What you need to do is clonse the Bitmap and then dispose it:
using (Bitmap bmp = new Bitmap(imageLocation))
{
pctInternet.Image = (Bitmap)bmp.Clone();
} It's good to use the using block statement for IDisposable implementation because it ensures that objects are disposed even if an exception occurs (it compiles to a try-finally block).
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]
|
|
|
|
|
That doesn't work though. Another work around might be the following:
string loc = @"C:\image1.gif";
using(Bitmap bmp = new Bitmap(loc))
{
using(Graphics g = Graphics.FromHwnd(this.Handle))
{
g.DrawImage(bmp, 5, 5);
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
When I set the user account to be disabled or change password at next logon Properties["userAccountControl"].Value always returned ADS_UF_NORMAL_ACCOUNT (512).
Any ideas?
|
|
|
|
|
And this has to do with C# how?
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]
|
|
|
|
|
If you want to disable the account set your userAccountControl value to 514 (0x202).
- Nick Parker My Blog | My Articles
|
|
|
|
|
I want to see which accounts are locked out.
|
|
|
|
|
If you want to check a particular account, the following will work:
string path = "LDAP://Blah=blah,Blah=blah";
DirectoryEntry de = new DirectoryEntry(path);
int val = Convert.ToInt32(de.Properties["userAccountControl"][0];
if((val & 0x202) == 0)
MessageBox.Show("Account is disabled");
- Nick Parker My Blog | My Articles
|
|
|
|
|
It works if user account is disabled, but does not work if account is locked out ((Convert.ToInt32(de.Properties["userAccountControl"].Value & ADS_UF_LOCKOUT) == ADS_UF_LOCKOUT)
|
|
|
|
|
Zackmac wrote:
but does not work if account is locked out ((Convert.ToInt32(de.Properties["userAccountControl"].Value & ADS_UF_LOCKOUT) == ADS_UF_LOCKOUT)
You need to check if your add operation equals 0, not 0x0010 - 16 (ADS_UF_LOCKOUT). Try this for a lockout checking:
string path = "LDAP://Blah=blah,Blah=blah";
DirectoryEntry de = new DirectoryEntry(path);
int val = Convert.ToInt32(de.Properties["userAccountControl"][0];
if((val & 0x210) == 0)
MessageBox.Show("Account is locked out");
- Nick Parker My Blog | My Articles
|
|
|
|
|
You don't understand me. Problem is userAccountControl value is not reflected when account is locked, but the userAccountControl value changes when the user account is disabled.
|
|
|
|
|
Anyone know of any samples for writing a streaming audio server?
|
|
|
|
|
Hello
I have been tryin to customize the Code appear for iEtoolbar
www.codeproject.com/csharp/dotnetbandobjects.asp
Instead of Click,I am willing to Implement DocumentComplete Event,guide me please
Thanks
|
|
|
|
|
If you have questions about a particular article, ask at the bottom of the article in the article message board: that's what it's there for. This forum is for C#-related and typically general .NET questions 1) not related to a specific article, 2) not related to a specific product or library, and 3) isn't about ASP.NET (there is a forum more specific to that topic here on CodeProject).
There are answers to that question already. In fact, the first question is what you want and I went ahead and posted a reply. Be sure to read it. If you don't understand, don't come back here; continue the thread in the article's message board.
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 am sorry,you are right,infact i had to post there but did here without noticing the rules
but it could be good if you gave the link of the post you made on that article..
right now i am searching it in archieve..
Thanks
|
|
|
|
|
|
Not sure if this is in the correct forum or not.. but I had to rant
Does anyone else HATE writing reports that MUST be printable?
Life would be so much easier if our Admin would let us use
SqlServer Reporting Services or Crystal Reports... but nooo
ok.. sorry had to get that out
Will
|
|
|
|
|
> Not sure if this is in the correct forum
The soapbox dude.
If your admin has an issue with Crystal Report running over the network you can run it on the local machine.
Alex Korchemniy
|
|
|
|