|
I should check if user’s mail exists or not, when she/he enters in my web application. But in asp.net we can just send an email with classes in the System.web.mail namespace. But as I mentioned, it is vital in my web application that user’s mail is a real mail. So I should check it if it is real or not (except its format).
Please instruct me to solve my problem with mail checking.
Thanks a lot.
Thanks Rastegar
|
|
|
|
|
There is no way that you can automatically check for certain if the mail address exists.
You can ask the mail server if it will accept the mail address, but that is not a guarantee that the address is correct. Large mail servers (for an example hotmail) will accept any address, as it's too much work to check the address both before and after recieving a mail.
The only way that you can be certain that the address works is if you send a mail to the user, that contains an address where they can confirm the address.
---
b { font-weight: normal; }
|
|
|
|
|
Check out MailChecker [^]. MailChecker is a DLL that lets you check the validity of an Email address by querying the mail server responsible for the email address and asking it via SMTP if the email is valid.
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
|
I'm designing a class library Foo that will contain several classes (Bar , Derf , etc.). Foo will be released as the single assembly Foo.dll and will exist in the namespace MyCompany . IOW, clients of the Foo library will write code like this:
using MyCompany.Foo;
...
Bar bar = new Bar();
...
What's the recommended method for laying out the Foo solution?
Bar.cs resides in the solution's top level folder and contains:
namespace MyCompany {
namespace Foo {
public class Bar {
...
}
}
}
Bar.cs resides in the in the solution's top level folder and contains:
namespace MyCompany.Foo {
public class Bar {
...
}
}
Bar.cs resides in the folder /MyCompany/Foo/ within the solution (a la Java) and contains the content specified in either (1) or (2). I know .NET doesn't infer namespace definition and membership from directory layout, but is this the recommended method for organizing source code?
- Something else?
Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I think that you should name the assembly after the namespace, e.g. MyCompany.Foo.dll. That will follow the way Microsoft names the assemblies in the framework, for an example the System.Runtime.Serialization.Formatters.Soap namespace is in System.Runtime.Serialization.Formatters.Soap.dll.
There is no reason to nest the namespaces if they only contain a single namespace. Stick with the second layout whenever you can.
If you have a large number of files, you can put them in separate folders to keep track of them, otherwise i think that you should just name the files after the namespace, e.g. Foo.Bar.cs.
Note: In C# you can have several classes in a file. It's not like Java where (AFAIK) you need a separate file for each class.
---
b { font-weight: normal; }
|
|
|
|
|
|
Do you, or is it bad practice to do this sort of thing: Class A { Class B {} } ? I have never seen any of the book examples show that you ever would do this.
Here is the example I was working on.... the first class Tester code (not commented out) does not compile (error: The name Temperature does not exist in the current context). But below the commented out class Tester code will work because I removed the Values class. Is there a way to get it to work without removing the Values class. ( Please keep in mind, some of this might not be a very practicle example.... i.e. it really does not make sense to have the Values class in the first place!)
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace EnumFreezingInRun
{
// this gives error "The name Temperature does not exist in the current context"
class Tester
{
class Values
{
enum Temperatures
{
WickedCold = 0,
FreezingPoint = 32,
}
}
public void Run()
{
Console.WriteLine("Freezing is: {0}", (int)Temperatures.FreezingPoint);
Console.WriteLine("Wicked cold is: {0}", Temperatures.WickedCold);
}
static void Main()
{
Tester t = new Tester();
t.Run();
}
}
// This does work!
//class Tester
//{
// enum Temperatures
// {
// WickedCold = 0,
// FreezingPoint = 32,
// }
// public void Run()
// {
// Console.WriteLine("Freezing is: {0}", (int)Temperatures.FreezingPoint);
// Console.WriteLine("Wicked cold is: {0}", Temperatures.WickedCold);
// }
// static void Main()
// {
// Tester t = new Tester();
// t.Run();
// }
//}
}
|
|
|
|
|
LuluSailor wrote: Do you, or is it bad practice to do this sort of thing: Class A { Class B {} } ?
I wouldn't say it was bad practice. Only that there are a limit number of situations that would warrant this.
The only one I can think of is to have the enumerator (a class deriving from IEnumerator) as an inner class of the one that it enumerates (which will normally implement IEnumerable).
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Thank-you for taking the time to answer my question Colin. It did seem that this is not too common, since I did not see it done in examples (class A {class B{}} )
So is there another way to get the code to work, other than remove the pluck out (delete) the Value class from the code? I am just curious how I would get the Temperatures to become available/ or in context without removing the class.
Although - my main concern you have answered, which is how common it would be to define a class within a class. I am still not sure what I am really doing when I define a class within a class. But this might be a bit too advanced for me right now. For now - I will not do it (accidentally or otherwise)!
|
|
|
|
|
Another reason that you may want to define an inner class relies on how you will use B in class A{ class B{} } . If only A uses B and no other class should use B , then a private inner class would work well in that situation.
For example, if you write a class that acts as a binary tree that supports only adding, searching, and removing, then you may never need to expose the class that implements the node in that tree structure. Thus, you could have something like the following incomplete code snippet.
public class Tree
{
public Tree() {
public object Search( object obj ) {
public void Add( object obj ) {
public void Remove( object obj ) {
private class Node
{
public Node( object o ) {
}
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
A simple resolution:
using System;
using System.Collections;
using System.Text;
namespace EnumFreezingInRun
{
class Tester
{
class Values
{
public enum Temperatures
{
WickedCold = 0,
FreezingPoint = 32,
}
}
public void Run()
{
Console.WriteLine("Freezing is: {0}", (int)Values.Temperatures.FreezingPoint);
Console.WriteLine("Wicked cold is: {0}", Values.Temperatures.WickedCold);
}
static void Main()
{
Tester t = new Tester();
t.Run();
}
}
}
|
|
|
|
|
I am writing a library and a class that uses it, but somehow, when I change something in the library, after I run it and re-add it as reference, the class still uses old library, any idea?
I tried rebuilding/compiling still nothing.
I closed visual studio and opened back up after removing the reference still uses old library.
Added the library as a new solution to my project still uses old library
Deleted all files in the debug/release folders still uses old library
What am i doing wrong here?
Cant seem to figure this one out, "real headache"
Can someone help me?
Thanks
|
|
|
|
|
Perhaps the reference in the client class is pointing to a local copy of the library (and not the library's /bin instance)?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Ok perhaps it is......
what do i do???
if it is not what do i do???
-- modified at 11:01 Saturday 28th January, 2006
Perhaps the reference in the client class is pointing to a local copy of the library (and not the library's /bin instance)?
How and where do i check to see if it is pointing to a local copy of the library???
Thanks for replying
|
|
|
|
|
Modify the reference (in your client project) to point to the dll in the library's /bin/Debug (and /bin/Release for the release configuration) folder. When you (re)build your client project, the latest versions of the appropriate DLLs will be copied (if necessary) from the library's folders into your client's.
Hope this helps!
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I assume the class library is not part of the same solution? In that case, add a reference to the DLL, then right click on the reference in Solution Explorer, click Properties and set Copy Local to false.
If it's part of the same solution, then when adding the reference, add it from the Projects tab in the "Add Reference" dialog box.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
awesome!! got it to work thanks guys
|
|
|
|
|
I need to know if in C# language there's classes that allow me to acceses information from the hard disk.... or if there's an API for that... i'm a begginer in this..
El sammy
|
|
|
|
|
|
.NET Framework 2.0 has the DriveInfo class that you can use to get a list of drives and info about each of them.
--
Hello, I'm a signature virus. Copy me into your signature to help me spread.
|
|
|
|
|
hi, i need create appz for using/control modem v32 bis.
where i can read some manual about this.
thx.
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
i want to make a setup project that creats a database to target machine
is there anybody who knows ??
|
|
|
|
|
isnt there anybody who knows how to do this? it is very important and urgent for me
|
|
|
|
|
Hi
Please let me to ask my problem from you.
I want to record user's sound. may be there are several codes to do this.
But I want that my program create blank wave file and then open Windows Sound Recorder that record sound on that blank file.
Openning Sound recorder is easy :
<br />
Using System.Diagnostics;<br />
Process.Start("sndrec32.exe");<br />
How can i create blank file and enforce Sound Recorder to use that file.
Please Help me
Thank You.
-- modified at 5:29 Saturday 28th January, 2006
|
|
|
|