|
NO i do not have a smtp server running.. I want help about this...
|
|
|
|
|
Then you cannot send an email to that port. Google for " free SMTP" to find one.that you can use.
|
|
|
|
|
Can you suggest me any open source smtp servers..
|
|
|
|
|
|
http://www.systemnetmail.com/[^] is a good place to start.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am getting "Failure sending mail" and it said Socketexception unable to connect.
I am using windows8 and visual studio 2010. And I have ran the web application from visual studio. Should i do anything else ..
Below is my code..
<pre lang="c#">
string from = "no-reply@retro.com";
string to = "rajeshvec2006@gmail.com";
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new System.Net.Mail.MailAddress(from, "test", System.Text.Encoding.UTF8);
mail.Subject = "test";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "hai";
mail.BodyEncoding = System.Text.Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "Localhost";
client.Send(mail);
</pre>
Could you please help me in this..
|
|
|
|
|
I see that the SMTP client is not configured properly. I had a very similar problem while try to send an email from my C# application.
I resolved that by configuring the SMTP client correctly. Please make sure you set all the necessary SMTP client properties, like,
- Host
- Port
- UseDefaultCredentials
- EnableSsl
- ServicePoint
Check your credentials(if you are not using the Default credentials)
|
|
|
|
|
The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
I am running this application in my local machine. So no heavy DB queries and all. I have pasted my code below. This error happens on con.Open()
string connString = ConfigurationManager.ConnectionStrings["DL"].ConnectionString;
using (SqlConnection con = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("spGetAllEmployees", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Employee employee = new Employee();
employee.ID = Convert.ToInt32(rdr["ID"]);
employee.Name = rdr["name"].ToString();
employee.Gender = rdr["gender"].ToString();
employee.City = rdr["city"].ToString();
employee.DateOfBirth = Convert.ToDateTime(rdr["dateofbirth"]);
Employees.Add(employee);
}
}
Help me to resolve pls.
Thanks, Geetha
|
|
|
|
|
|
I tried setting it. but did not work.
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
|
|
|
|
|
Did you set ConnectionTimeout and/or CommandTimeout?
If so, what values did you use?
Can you post the code of where you set these values?
Have you further details of the exception? i.e. What object has timed out?
|
|
|
|
|
The timeout error happens with connection object. Initially, i didnt have connection timeout value in the connection string. after reading prev msg, i set the connection timeout value in connection string and the value of conn string is as follows
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
Also, I tried to see the values of
Console.WriteLine("State: {0}", con.State);
Console.WriteLine("ConnectionTimeout: {0}",
con.ConnectionTimeout);
while there was a time out error thrown on con.Open(), I hover over the state and timeout value in the above statement to see the values, the timeout was set to 30 and the state was closed.
|
|
|
|
|
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source=System.Data
StackTrace:
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
|
|
|
|
<connectionStrings>
<add name="DL" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
providerName="System.Data.SqlClient" />
</connectionStrings>
|
|
|
|
|
|
Thank you for your message. I will give you the clear picture of what the issue is.
I have written a small app to test MVC. In my application, I created MVC project and used View and controller from the MVC project itself but for the model, I created a class library project and a class within that project will query the database using ADO.net and get the details and store it in an object and the object would be passed to MVC application.
In this application only, I am not able to fetch the data from the database. I used localdb from the sql server bundled with VS2013.
I created a separate console application and tested the database access. It works perfectly fine. I get back the response from the database.
|
|
|
|
|
How/where to set the Anti-MIME-Sniffing header X-Content-Type-Options to 'nosniff' for all aspx pages
|
|
|
|
|
Probably the best is to add it in your IIS, it will be there for application you ever write!
If it's not an option, use web.config, like this:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Hello !
I want to create a MVC 5 application using Visual Studio 2013 .
I have the following problem :
I created a controller to display data from a table and then created a view using Add View for the
return View(); method . The view is created , but when I try to go to the view from the controller , the "Unable to find a matching view" error is shown . How can I link the view to the controller ?
Sorry if this question was asked before .
|
|
|
|
|
Problem solved , apparently my view wasn't named properly .
|
|
|
|
|
Hi,
Your View Name is same as controller Method Name and also in correct folder as per Controller Name ?
Thanks
Raviranjan
|
|
|
|
|
I created the view , but renamed it , so the controller didn't recognize it . Thanks !
|
|
|
|
|
Hi,
I want to develop a Survey module using MVC4, for that i have a set of questions for each questions i have 4 options & these options should be radio button in the application and all questions will be having same options
EX, Agree,Disagree, Strongly agree,Strongly Disagree.
How can i achieve this using MVC4. I tried several links but no link is helping out
EX: Tried This[^]
NOTE: I am a beginner in MVC
|
|
|
|
|
Hi Vishal,
So you mean that, let say Quetion1, Question2, Question3,... and for each question you will have Option1, Option2, Option3, Option4 and for each question you will have - Agree,Disagree, Strongly agree, Strongly Disagree,
Like
Question1
Option1, Option2, Option3, Option4
Disagree, Agree, Strongly Agree, Strongly Disagree
Question2
Option1, Option2, Option3, Option4
Disagree, Agree, Strongly Agree, Strongly Disagree
.....................
Right?
Thanks
Raviranjan
|
|
|
|
|
Hi Raviranjan,
Thanks for the reply,
Ya exactly i wanted and achieved it,
Thanks
Vishwa
|
|
|
|