I want to send the verification mail before the user can sign in for which I have written some code, but the problem if that it gives the error "Could not find a part of the path", but I cannot understand why it is giving the error. The error occurs while trying to read the .txt fle using StreamReader.
it says - Could not find a part of the path 'C:\JobPortal\EmailTemplates\VerifyNewUser.txt'.
but it should be searching at the following path -
Instead of ApplicationPath try Server.MapPath. This will give the location relative to the server files (within IIS or whatever server you are using) instead of the location of the files on disc ,which is what ApplicationPath is giving you.
Server.MapPath will give the location from localhost, instead of from the C drive.