Category Archives: Authorization

setting web config for send email through 1and1 hosting

 I have mailbox with forward to gmail acound in 1and1 hosting

the code:


<mailSettings >

<smtp deliveryMethod="Network" >

<network host="" port="25" password="mailbox-password" defaultCredentials = "true" />




 protected void submit_Click(object sender, EventArgs e)





MailMessage msg = new MailMessage();

msg.From =new MailAddress(txtEmail.Text.Trim());

msg.To.Add(new MailAddress(""));

msg.Subject = txtName.Text.Trim();

msg.IsBodyHtml =true;

msg.Body ="message: " + txtContent.Text.Trim() + "<br /><br />" + "phone: " + txtPhone.Text.Trim() + "<br /><br />";


SmtpClient smpt = new SmtpClient();


txtName.Text ="";

txtEmail.Text ="";

txtPhone.Text ="";

txtContent.Text ="";

lblOk.Visible =true;





lblOk.Visible =true;

lblOk.Text ="faild to deliver ";



The code is not working and not bringing me an error. Does anyone can tell me what is wrong????



Hi ,

I think you have to provide the SMTP Credentials , See the below code


MailMessage m = new MailMessage
    "This is the subject for the authorized email.",
    "This is the body of the authorized mail!...");
// Send the message using authorization
SmtpClient client = new SmtpClient("");
client.Credentials = CredentialCache.DefaultNetworkCredentials;
// or client.Credentials = new NetworkCredential("user", "password");

Also check the server name is correct.  For the UK I know it is, so yours might well be

Thanks you for your comments, but it didnt worked.

This is the script from 1and1 faq in vb

does anyone know how to convert this to c#?

dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

fromName        = "Test ASP Script"
fromAddress     = ""
recipientName   = "Your Name Goes Here"
recipientAddress= ""
subject         = "Enter a Subject Title Here!"
body            = "Enter the Body of the Mailing Here!"


sentTo = "NOBODY"
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = fromName
Mailer.FromAddress = fromAddress
Mailer.RemoteHost = ""
if Mailer.AddRecipient (recipientName, recipientAddress) then
sentTo=recipientName & " (" & recipientAddress & ")"
end if
Mailer.Subject = subject
Mailer.BodyText = body
if Mailer.SendMail then
Response.Write "The mailing was sent to: <b>" & sentTo & "</b>"
Response.Write "Mail send failure. Error was " & Mailer.Response
end if


I have mailbox with forward to gmail acound in 1and1 hosting

If it's going to gmail, shouldn't you be trying to get it from gmail?


does anyone know how to convert this to c#?


[RESOLVED] Is it Possible to show Hide submenu based on sql tables with existing sitemap method

Hi All,

I am using asp.net2.0 , C#


I am binding menu control with sitemap to display menus and submenues. Which also restrict access and display of menu or submenu based on user's roles.

 I want to know Is it Possible to show/ Hide submenu based on sql tables with existing sitemap method




According to your description ,as far as I know a common requirement for Web sites is to restrict access to certain pages. The combination of ASP.NET role management and ASP.NET URL authorization provide a way to restrict access to Web files based on security roles. Site maps complete the story by using a feature called security trimming to hide the navigational links to those restricted files, also based on roles.

I would like to suggest you to check the links below for more information about ASP.NET Site-Map Security Trimming.


I want to know Is it Possible to show/ Hide submenu based on sql tables with existing sitemap method

Here is a similar thread which provides the sample code that shows how to hide the itmes of menu control manually by using Menu's prerender event(Menu_PreRender).

Hope it can help you.

[RESOLVED] form authentication example with role

Please give me the full code for authentication and authorization....


In my project there are three folder...




Now I want to make security for all folder with some role based ... so student user can not access faculty and .... same faculty can not access student pages....

Give the  content of web.config file.......


Follow the tutorial and you'll learn to do it yourself. It is easy to say "Give the content of web.config file" instead of trying to actually do it.

Again...Here is an article..follow it and learn something more in the process: