|
At work I'm making a program n C# for adding new users to our AD and I want to set it up to send information to the newly created users via e-mail. Does anyone have any information on sending e-mail through exchange? All I can find is using Outlook which isn't working too well. Should I just use SMTP instead?
|
# ? Jan 6, 2007 05:57 |
|
|
# ? May 6, 2024 21:40 |
|
^^^^Use SMTP (protip: excange is generally also a SMTP server). In .NET 1.x, you need to use System.Web.Mail. In .NET 2.0, use System.Net.Mail.
|
# ? Jan 6, 2007 16:10 |
|
Just to be clear, this is just an access layer for smtp. Here is a bit of overkill information. Feel free to ignore it unless you are a bit more interested in mail on an Exchange box. I used to work for Exchange, and can say that it is easier to use smtp in most cases... even if there is an alternative available in Exchange. (Special aspects of Exchange are slightly more difficult to use because they are mostly available through COM and active directory.) Just for a bit more background: If you are using an older version of exchange, then it is built upon the smtp stack included with windows xp. New versions of Exchange have their own smtp stack. Basically though, it is still smtp at its core. Anything that can be done as far as sending and recieving mail is concerned can be done using industry standard techniques (smtp, imap, pop) on an exchange server. Exchange also offers some other extensions and features to smtp. These mostly relate to better performance (more messages per second), better storage features (mailbox quotas and backups), better user access options (stopping a recursive reply all from unprivilaged users), spam blocking, and much more security.
|
# ? Jan 7, 2007 07:08 |
|
What would be the easiest way to accomplish the following: 1. Read an XML file. 2. Grab the data in between the tags. 3. Assign data to strings for each entity. I've been yanking out my hair trying to figure out how to do this with an XmlDataSource on a code behind ASP.Net page with no luck at all (as simple as it sounds like it's supposed to be). I then talked to someone else and he informed me of the XmlDocument class, but then it references so many other classes that I'm not even sure to begin. While I'm at it actually, tell me if this code looks right to you: code:
code:
pliable fucked around with this message at 21:52 on Jan 8, 2007 |
# ? Jan 8, 2007 21:48 |
|
2 Basic Ways to Hit This: 1) Use XmlSerialization to deserialize the XML into a class. Easiest if the Xml is managable for this purpose. Can you show a more full example of the xml? 2) Use XmlDocument to load the document, then loop through appropriate nodes and pull the data. This can be the easiest method under some circumstances. Something like: code:
|
# ? Jan 8, 2007 22:55 |
|
pliable posted:clipped code:
Fiend fucked around with this message at 23:05 on Jan 8, 2007 |
# ? Jan 8, 2007 22:58 |
|
pliable posted:Stuff Here's how I usually do it. It might not be the most efficient way (I've never messed with anything else), but it works. code:
|
# ? Jan 8, 2007 23:02 |
|
wwb posted:Can you show a more full example of the xml? I can't share the actual XML file, but here's basically what it looks like: code:
pliable fucked around with this message at 23:38 on Jan 8, 2007 |
# ? Jan 8, 2007 23:30 |
|
I've put in a many hours on this one now and I'm not much further then I was when I started... Is it possible to have to versions of the same dll representing the same namespace with many of the same classes coexist on the same web application? I got as far as referencing both assemblies, but I end up with "your class" is ambigious in the namespace "your.custom.namespace". The practical application here is I have to seriously restructure a core namespace but I cannot remove the existing namespace as it will break quite a bit of functionality.
|
# ? Jan 9, 2007 06:42 |
|
pig-fukr posted:I've put in a many hours on this one now and I'm not much further then I was when I started...
|
# ? Jan 9, 2007 07:00 |
|
pig-fukr posted:I've put in a many hours on this one now and I'm not much further then I was when I started... I'm not sure exactly how, but did you try aliases? Or extern alias? Here's a code project with a basic write-up: http://www.codeproject.com/csharp/aliases.asp At least with extern alias, you can distinguish the same namespaces with different names: http://msdn2.microsoft.com/en-us/library/ms173212(VS.80).aspx Hope that helps.
|
# ? Jan 9, 2007 11:25 |
|
pliable posted:I can't share the actual XML file, but here's basically what it looks like: How is that Reports structure handled? Is it actually dynamically named nodes, or is it something like <reports><report /><report /></reports>? Also, do you have a schema? If so, you can use xsd.exe to generate a class for deserialization, then use XmlSerialization to put the data in that class. Finally, I forgot to mention one .NET 2.0 method: implement IXmlSerializable. This will let you use XmlSerialization but will not tie you to the default rules of XmlSerialzation. Which might be what you need in this case.
|
# ? Jan 9, 2007 18:45 |
|
FuraxVZ posted:I'm not sure exactly how, but did you try aliases? Or extern alias? After providing my research I was able to convince the powers that be that a major namespace restructuring would best be handled by changing the root name of the namespace itself. Problem solved. ** Extern aliases were the closest I came to a workable solution though, thanks for that.
|
# ? Jan 9, 2007 22:29 |
|
What's the best way to program for something that requires your module to be registered on the GAC? I have a VS2005 Template wizard I've been working on, set up to automatically itself and register itself in my GAC every time it successfully compiles (using "gacutil.exe /if $(TargetName)" in the post-build state. This works the first time and the wizard displays properly, but every subsequent time I rebuild the wizard and test it with the project template, it uses the first version. This still occurs even if I go into the GAC and manually remove it in between builds. The only way I can get a new result is by changing the version number referenced in the template and redeploying it (which is out of the question). On a slightly related note, is there a way, be it through the .vsTemplate file or a wizard, to add files to an existing project in the solution? (ie, for an Asp.NET website, a project template would create a class library called "NewModule", as well as add NewModule.txt to the website's project).
|
# ? Jan 10, 2007 02:31 |
|
You need to remove it from the gac and then reboot your machine. There is an internal tool at the place that I used to work at that accomplishes the removal from the dllcache without requiring a reboot. (It was a special version of the delete command) But, even that did not work all of the time. It only worked sporadically -- which of course sucks. Rebooting your machine should cause the cache to flush and the deleted assembly to actually go away. Sorry about this. I had to deal with it a lot at my old job, and there is really no good way around it (that I am aware of) outside of the hive. Can you do a lot of the work without using gac, and then add the gac cache feature towards the end of development? On another note, a good tip is to not sign your assemblies until close to the end of the development cycle too.
|
# ? Jan 10, 2007 05:59 |
|
Boogeyman posted:Hopefully that helps a bit. Maybe some other people will chime in if there are better ways of doing this type of thing. Fiend posted:
I think these would actually help very much. Thank you much gentlemen .
|
# ? Jan 10, 2007 09:01 |
|
Grid Commander posted:You need to remove it from the gac and then reboot your machine. Unfortunately, the VS2005 template engine seems to require a strongly named and signed assembly in the cache to run a custom wizard. I'm interpreting this as meaning that I have to sign it and add it to the cache each time I want to test a new build. I could be wrong about that (this is the first time I've worked with the GAC). I'm thinking I'll have to write a quick program that will test the wizard for my internal builds and then hope that the wizard itself will work with the real template system. Thanks for the help.
|
# ? Jan 10, 2007 15:35 |
|
ASP.Net newbie here. Is there a way, codewise, to force a print to the clientside LPT1 port, besides setting it as the default in Windows? I just need to explore my options before going ahead with a small company project. Thanks. Boosh! fucked around with this message at 21:14 on Jan 10, 2007 |
# ? Jan 10, 2007 18:53 |
|
Ok, here's a bizarre one... Synopsis is I'm trying to return the current hostname given an ip. I use this code to do so: Dim HostEntry As IPHostEntry = Dns.GetHostByAddress(Request.UserHostAddress) Response.Write(HostEntry.HostName) When I do this locally all is well. When I do this on production I get a completely and totally random hostname back. The gently caress?
|
# ? Jan 10, 2007 18:54 |
|
I want something that will take an integer and return a fixed width string. The integer will always be between 1 - 9999 and the return string will always be 4 digits in length. Ideally, when I pass "10" to the function, it should return "0010". I can do something like this... code:
code:
|
# ? Jan 10, 2007 19:27 |
|
pig-fukr posted:Ok, here's a bizarre one...
|
# ? Jan 10, 2007 19:28 |
|
Fiend posted:What do you mean by "locally" and "production"? Is the production machine a box with multiple ip addresses and multiple names? "local" would be my personal machine that is nothing more then a workstation. "Production" is a non-clustered asp.net 2.0 application on a web server with a single ip address servicing requests only on port 80 to that single address. Both the "local" and "production" machines are on the same domain and subnet, as are the "remote" hosts that I am trying to resolve. The entire context of the website is an intranet site which is authenticated via AD.
|
# ? Jan 10, 2007 19:31 |
|
pig-fukr posted:"local" would be my personal machine that is nothing more then a workstation. Do the return values imply that production and the workstation are using different DNS entries? Is there also a setting for doing reverse lookups, or am I thinking of something else?
|
# ? Jan 10, 2007 19:39 |
|
Fiend posted:What is the best method of doing this? Is there a formatting command that I can use in ToString() like you would when you're formatting dates? Just tried this and it worked... code:
|
# ? Jan 10, 2007 20:35 |
|
Fiend posted:Do the return values imply that production and the workstation are using different DNS entries? Is there also a setting for doing reverse lookups, or am I thinking of something else? Primary and secondary DNS servers are identicle for both machines, which is further infuriating. I should also add that when I remote desktop into the webserver where the call is failing, I am able to ping my workstation by both IP and hostname. I'm stuck on how the server itself is able to resolve the correct hostname but code calling the same function on that server fails.
|
# ? Jan 10, 2007 21:34 |
|
Boogeyman posted:Just tried this and it worked...
|
# ? Jan 10, 2007 21:37 |
|
pig-fukr posted:Primary and secondary DNS servers are identicle for both machines, which is further infuriating.
|
# ? Jan 10, 2007 21:38 |
|
Fiend posted:I don't think both pieces use the same code. I don't know enough about how .NET does things to really argue the point. The machine itself seems to have a properly enough configured DNS resource that it can resolve the remote targets in question via command line.
|
# ? Jan 10, 2007 21:46 |
|
pig-fukr posted:I don't know enough about how .NET does things to really argue the point. The machine itself seems to have a properly enough configured DNS resource that it can resolve the remote targets in question via command line.
|
# ? Jan 10, 2007 21:50 |
|
What is the easiest way to copy files from a physical path on a hard drive to a SQL database? I'm very very new when it comes to SQL, and all the books I have tell how to upload them from an ASP FileUpload control, but not really from a physical path. It can't be that hard, can it?
|
# ? Jan 11, 2007 20:16 |
|
Something like:code:
2) Bind the byte array to a parameter. 3) Execute the command.
|
# ? Jan 11, 2007 20:38 |
|
pliable posted:What is the easiest way to copy files from a physical path on a hard drive to a SQL database? I'm very very new when it comes to SQL, and all the books I have tell how to upload them from an ASP FileUpload control, but not really from a physical path. Please don't put files in databases If you do, learn how to put the binary data into seperate sql datafiles, and have the table put the data there. Please
|
# ? Jan 11, 2007 20:45 |
|
wwb posted:1) Get the files in a byte array, probably using the handy new static functions in the File class. Do you have AIM or something? You are like, a loving .Net God, and I'd appreciate your godly support in the future (plus I want to ask you more about this). Heffer posted:Please don't put files in databases It's not really my choice; this is what my boss and supervisor wants done. But what's wrong with putting files into a database? We're going to still keep the copy from the physical path, so.
|
# ? Jan 11, 2007 20:57 |
|
superb0wr posted:Anybody know what those [SquareBracket] directives or whatever you can use in c# are called, and if its possible to write custom ones? Like [STAThread] or [WebMethod]? For example, I have a messaging system that verious components register with. In a simple example, say I have a class that wants to know when a Customer is added to the transaction so it can update its display. code:
code:
code:
My UI works this way too. Any object can describe itself visually, providing colors, images, custom formatting text, positioning info, special conditions, font appearance...pretty much everything for any or all properties it contains. I have a UI control that reads in the layout info and displays it on the screen. This means that the "Customer" you see on the screen and the completely non-UI related Customer class that represents a row in a Customer table are basically the same thing. There are no "CustomerName" or "Age" textboxes. The UI Control you see was written before the Customer class ever exisited and the customer class contains all the information required to get it on the screen. I don't know if you needed any of that information but I found attributes to be great for writing classes that describe themselves in a number of useful ways. (You should see the Transaction object - it is a single class that can be displayed on the screen to give you Totals, Tax Info, item counts, amount due, etc, and also handles sending and receiving of enough messages to basically handle all the details of a sales transaction. Yet nothing outside of that single class even knows it exists)
|
# ? Jan 11, 2007 21:06 |
|
Heffer posted:If you do, learn how to put the binary data into seperate sql datafiles, and have the table put the data there.
|
# ? Jan 11, 2007 21:09 |
|
pliable posted:Do you have AIM or something? You are like, a loving .Net God, and I'd appreciate your godly support in the future (plus I want to ask you more about this). Here's example #1 of how things could go wrong. Say you have a table that contains a field for an ID number (2 bytes) a date (8 bytes) and the file itself (32,000 bytes). The rows for the table ordinarily get stored consecutively on the disk, and the database only keeps track of where the first row is, apart from indexes and such. You want to do a simple thing, like get the file that was uploaded at a specific date. The database reads the first chunk of the table at 64KB per read. The first read gets it two rows to check. Neither match. It goes back to the disk and reads the next 64K. Neither of the new ones match. It does this for 1000 times. It's read 64 megabytes of your disk, looking for a single 32K file out of two thousand. If you had done this by storing the 240 character filename instead of the actual file, you read 2000 * 250 = 500KB, which only takes 8 read operations instead of 1000. Here's example #2 of how things can go wrong. You have a database for your family photo album. Your sister, mother, father, and cousins can all log in and upload and downlaod photos. You have several people viewing files from the database at one point, each one requiring one database call, and about 500K per database IO operation, with multiple files viewed on one page. You end up with a database that is 0.1% data and 99.9% files. With all this responsibility, your database gets swamped with pushing in and out gigabytes of files day in and day out. Little queries like validating passwords get drowned out because your database is so busy acting as a fileserver. Now, there are cases where it's sensible to have files in a database. Basically where you A) Have serious transactional, versioning, accuracy, and safeguarding needs and you can afford the pain and torment of having files stuffed into a database, and B) Where you're doing in-database searching and indexing of the documents, such as for full text queries. Everywhere else, it makes sense to store the file with a file system. (The textimage stuff Victor was talking about allows you to avoid some of the penalties of storing large blocks of binary data in the database, but not all)
|
# ? Jan 11, 2007 21:52 |
|
Heffer posted:Basically where you A) Have serious transactional, versioning, accuracy, and safeguarding needs and you can afford the pain and torment of having files stuffed into a database... This is pretty much the reason why I'm storing files into the database. It's sensitive data, so it needs good safeguarding (despite the amount of safeguards we already have). As for getting the file, I'm storing both the file name and the file itself in the same table, so I don't think that should be an issue (hopefully). And as for traffic concerns, that's not really an issue either, as there won't be lots of traffic going on. But...I'll definitely keep what you said in mind if I create a database for myself in the future. Thanks .
|
# ? Jan 11, 2007 22:53 |
|
I have yet to manage to melt down a SQL server because it was serving files out of the database, but that is me. Anyhow, almost invariably, I tend to de-normalize a bit and setup a separate files table, which is effectively joined at the hip to the metadata table. This avoids ever hitting the file data except when you explicitly need the file data, while still keeping everything in the db. As for me, I don't really do IM. Especially since my main computer just died and I am sitting here setting up a replacement. Do feel free to post here, it is usually better to answer questions where others can get the benefit of the question and the answer. I do tend to keep a pretty good eye on this thread. PS: SLOSifl, that is some pretty slick stuff. wwb fucked around with this message at 23:04 on Jan 11, 2007 |
# ? Jan 11, 2007 23:02 |
|
Comments on NetTiers, anyone? http://www.nettiers.com From the site: netTiers is a set of open source code generation templates that simplify the tasks of creating customized Application Tiers for your Microsoft.Net applications in just a few minutes. .netTiers utilizes the power of the best code generation tool available today, CodeSmith Tools. .netTiers generated architecture is custom to your domain, uses familiar patterns, and follows the guidance of Microsoft's recommended patterns and practices. In fact, the .netTiers base architecture is built upon the Microsoft Enterprise Library Application Blocks. Oh right, .netTiers is FREE! The Noble Nobbler fucked around with this message at 23:10 on Jan 11, 2007 |
# ? Jan 11, 2007 23:07 |
|
|
# ? May 6, 2024 21:40 |
|
Having an issue with this code on one of two XP machines, both with the same config:code:
|
# ? Jan 11, 2007 23:17 |