Smtp error - STARTTLS

SMTP sunucusu güvenli bir bağlantı gerektiriyor veya istemcinin kimliği doğrulanmadı. Sunucu yanıtı şöyleydi: 5.7.0 Must issue a STARTTLS command first ...

Solution:

smtpClient.EnableSsl = true;

http://social.msdn.microsoft.com/Forums/tr-TR/aspnettr/thread/3e00e300-ea1e-41be-b2c1-b64e93aab60f/

sql cache dependency

aspnet_regsql.exe –S “.\yukon” –U “sa” –P “1” –d “CacheDepDemo” –ed
aspnet_regsql.exe –S “.\yukon” –U “sa” –P “1” –d “CacheDepDemo” –t “Ogrenciler” -et

Sample:

C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe -S localhost -E
-ed -d Yasatay -et -t MevzuatDetay
Enabling the database for SQL cache dependency.
.
Finished.
Enabling the table for SQL cache dependency.
Finished.

http://stackoverflow.com/questions/4379106/configuring-sqlcachedependency-with-aspnet-regsql

blog html code editor

http://www.simplebits.com/cgi-bin/simplecode.pl

internet explorer 7 and 8 updatepanel rendering error


Örneğin aşağıdaki gibi bir kullanım IE7 ve IE8’de hataya (UpdatePanel’in çalışmamasına) neden oluyor:

<table>
<tr>
<td>
...
</td>
</tr>
<asp:UpdatePanel …>

</asp:UpdatePanel …>
<tr>
<td>
...
</td>
</tr>
</table>

Yukarıdaki örnekte UpdatePanel uygun olmayan yerde bulunuyor. Şu hale çevirince düzeliyor:

<table>
<tr>
<td>
...
</td>
</tr>
</table>
<asp:UpdatePanel …>

</asp:UpdatePanel …>
<table>
<tr>
<td>
...
</td>
</tr>
</table>

consuming web service using webrequest

public const string WebServiceUrl = "https://xxx.xxx.com.tr/server/cms";
const string methodName = "PR_SWEP_URT_OTO_WS_KASKO_TEKLIF_POLICELENDIR";

doc.LoadXml(xmlRequest);
var req = (HttpWebRequest)WebRequest.Create(Constants.WebServiceUrl);
req.Headers.Add("SOAPAction", Constants.WebServiceUrl + "/" + methodName);
req.Headers.Add("Operation", methodName);
req.Headers.Add("Style", "RPC");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
var stream = req.GetRequestStream();
doc.Save(stream);
stream.Close();


public const string WebServiceUrl = "http://xx.xx.xxx.xxx:xxxx/PolServis";
const string methodName = "getKaskoPolice";

doc.LoadXml(xmlRequest);
var req = (HttpWebRequest)WebRequest.Create(Constants.WebServiceUrl + "/services/KaskoPoliceServis?wsdl");
req.Headers.Add("SOAPAction", Constants.WebServiceUrl + "/" + methodName);
req.Headers.Add("Operation", methodName);
req.Headers.Add("Style", "RPC");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
var stream = req.GetRequestStream();
doc.Save(stream);
stream.Close();

java.lang.NumberFormatException HTTP Error 500 Internal server error

AracBedeli 29750,00 formatında gönderildiğinde şu satırda hata oluşuyor:

var webResponse = req.GetResponse();

HTTP Error 500 Internal server error hatası dönüyor.
Ama SoapUI'da hatanın nedeni görülebiliyor:

soapenv:Server.userException java.lang.NumberFormatException: Not a valid char constructor input: 29750,00

Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator

code:
var cpList2 = (from customerProduct in _context.customer_products
join controlPolice in controlPolices
on customerProduct.sales_ID equals controlPolice.sales_ID
where customerProduct.yenileme_no == controlPolice.yenileme_no
&& customerProduct.zeyil_no == controlPolice.zeyil_no
select customerProduct);

error:
Local sequence cannot be used in LINQ to SQL implementation of query
operators except the Contains() operator

solution:
var cpList = (from controlPolicy in controlPolicies
join customerProduct in _context.customer_products
on controlPolicy.sales_ID equals customerProduct.sales_ID
where controlPolicy.yenileme_no == customerProduct.yenileme_no
&& controlPolicy.zeyil_no == customerProduct.zeyil_no
select customerProduct);

source:
http://stackoverflow.com/questions/5936301/local-sequence-cannot-be-used-in-linq-to-sql-implementations-of-query-operators-e

How to enumerate an enum?

How to enumerate an enum?

public static class EnumExtensions
{
///


/// Gets all items for an enum value.
///

///
/// The value. ///
public static IEnumerable GetAllItems(this Enum value)
{
foreach (object item in Enum.GetValues(typeof(T)))
{
yield return (T)item;
}
}

///
/// Gets all items for an enum type.
///

///
/// The value. ///
public static IEnumerable GetAllItems() where T : struct
{
foreach (object item in Enum.GetValues(typeof(T)))
{
yield return (T)item;
}
}

///
/// Gets all combined items from an enum value.
///

///
/// The value. ///
///
/// Displays ValueA and ValueB.
///
/// EnumExample dummy = EnumExample.Combi;
/// foreach (var item in dummy.GetAllSelectedItems())
/// {
/// Console.WriteLine(item);
/// }
///

///

public static IEnumerable GetAllSelectedItems(this Enum value)
{
int valueAsInt = Convert.ToInt32(value, CultureInfo.InvariantCulture);

foreach (object item in Enum.GetValues(typeof(T)))
{
int itemAsInt = Convert.ToInt32(item, CultureInfo.InvariantCulture);

if (itemAsInt == (valueAsInt & itemAsInt))
{
yield return (T)item;
}
}
}

///
/// Determines whether the enum value contains a specific value.
///

/// The value. /// The request. ///
/// true if value contains the specified value; otherwise, false.
///

///
///
/// EnumExample dummy = EnumExample.Combi;
/// if (dummy.Contains(EnumExample.ValueA))
/// {
/// Console.WriteLine("dummy contains EnumExample.ValueA");
/// }
///

///

public static bool Contains(this Enum value, T request)
{
int valueAsInt = Convert.ToInt32(value, CultureInfo.InvariantCulture);
int requestAsInt = Convert.ToInt32(request, CultureInfo.InvariantCulture);

if (requestAsInt == (valueAsInt & requestAsInt))
{
return true;
}

return false;
}
}

The enum itself must be decorated with the FlagsAttribute

[Flags]
public enum EnumExample
{
ValueA = 1,
ValueB = 2,
ValueC = 4,
ValueD = 8,
Combi = ValueA | ValueB
}

http://stackoverflow.com/questions/105372/c-how-to-enumerate-an-enum

generic list sorting - order by

If you mean an in-place sort (i.e. the list is updated):

people.Sort((x, y) => string.Compare(x.LastName, y.LastName));
If you mean a new list:

var newList = people.OrderBy(x=>x.LastName).ToList(); // ToList optional

http://stackoverflow.com/questions/188141/c-list-orderby-alphabetical-order

Unable to make the session state request to the session state server

Error:
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

Resolution:
ASP.Net State Service maybe doesn't work, or isn't enabled.
To start it go to Administrative Tools --> Services --> ASP.Net State Service...

To enable it go to Administrative Tools --> ... --> IIS ...
On Windows 7 go to --> Programs and Features --> ... --> ASP.Net ...

search this blog (most likely not here)