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:

<system.net>

<mailSettings >

<smtp deliveryMethod="Network" >

<network host="smtp.1and1.com" port="25" userName=info@xxxx.com password="mailbox-password" defaultCredentials = "true" />

</smtp>

</mailSettings>

</system.net>

 protected void submit_Click(object sender, EventArgs e)

{

try

{

 

MailMessage msg = new MailMessage();

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

msg.To.Add(new MailAddress("info@xxxx.com"));

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();

smpt.Send(msg);

txtName.Text ="";

txtEmail.Text ="";

txtPhone.Text ="";

txtContent.Text ="";

lblOk.Visible =true;

}

 

catch

{

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????

 

Thanks


Hi ,

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

 

MailMessage m = new MailMessage
   ("item@w3mentor.com",
    "raja@w3mentor.com",
    "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("smtp.w3mentor.com");
client.Credentials = CredentialCache.DefaultNetworkCredentials;
// or client.Credentials = new NetworkCredential("user", "password");
client.Send(m);

Also check the server name is correct.  For the UK I know it is auth.smtp.1and1.co.uk, so yours might well be auth.smtp.1and1.com

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#?

<%
'-----EDIT THE MAILING DETAILS IN THIS SECTION-----
dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

fromName        = "Test ASP Script"
fromAddress     = "address@domain.com"
recipientName   = "Your Name Goes Here"
recipientAddress= "yourEmailAddress@yourDomain.com"
subject         = "Enter a Subject Title Here!"
body            = "Enter the Body of the Mailing Here!"

'-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----


sentTo = "NOBODY"
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = fromName
Mailer.FromAddress = fromAddress
Mailer.RemoteHost = "mrelay.perfora.net"
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>"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>

mazal0404

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?

mazal0404

does anyone know how to convert this to c#?

http://converter.telerik.com/

 

[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

 

Thanks

Hi,

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.

http://msdn.microsoft.com/en-us/library/ms178428.aspx

http://weblogs.asp.net/jgalloway/archive/2008/01/26/asp-net-menu-and-sitemap-security-trimming-plus-a-trick-for-when-your-menu-and-security-don-t-match-up.aspx

mohdimranabdulaziz

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).

http://forums.asp.net/p/1606281/4105865.aspx

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...

Admin

Faculty

Student

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:

http://www.dotnetfunda.com/articles/article854-a-beginners-view--webconfig-.aspx

http://forums.asp.net/t/1658447.aspx/1?Authentication+based+on+roles+problem+