Wednesday, March 21, 2007
Developing SEO friendly URLs with ASP NET 2.0
at 11:49 AM 0 comments Posted by roni schuetz
Labels: links
Wednesday, March 14, 2007
surprise: int.TryParse(xx,yy)
I really get surprised about the following behaviour:
when I've tried to use the follwoing line of code:
if(!int.TryParse(row["myRowName"] as string, out myDefinedInt))
tryParse always returned me false and I assinged a default value. After making sure that all my rows have values for myRowName I were confused.
a friend suggested to use row["myRowName"].ToString() and voila it worked like i wanted.
I didn't really figured out why that happens, then in none of my cases the value were empty that my expression as string would return null.
here a bit more code:
DataSet data = DataReader.GetData();
DataTable tab = data.Tables["MyTableName"];
DataView view = tab.DefaultView;
view.RowFilter = "RowNameA LIKE '%" + valA + "%' AND RowNameB LIKE '%" + valB + "%'";
if (view.Count > 0)
{
Data.MyDataObject item;
foreach (DataRowView row in view)
{
item = new Data.MyDataObject();
item.SomeValue1 = row["SomeValue1"] as string;
item.SomeValue2 = row["SomeValue2"] as string;
int outData = -1;
if (!int.TryParse(row["SomeValue3"].ToString(), out outData))
{
item.SomeValue3 = 40;
}
else
{
item.SomeValue3 = outData;
}
etc ... etc ... etc ...
Thanks to richi (Y)
at 10:02 AM 1 comments Posted by roni schuetz
Labels: .net, code sample, MOSS, surprised
Saturday, March 10, 2007
How To: Implement your email sending with the asp:PasswordRecovery control
after a while i finally figured out what i have missed to prevent emails to sent twice - once over the control and once over my own logic.
Markup:
<asp:PasswordRecovery
ID="PasswordRecovery"
runat="server"
OnSendingMail="PasswordRecovery_SendingMail"
Code Behind:
protected void PasswordRecovery_SendingMail(object sender, MailMessageEventArgs e)
{
e.Cancel = true;
e.Message.Dispose();
.. here my own logic starts.
}
in the web.config file you need minimum the following configuration:
<system.net>
<mailsettings>
<smtp from="your email address">
</mailsettings>
</system.net>
</configuration>
.. evoila.. that's all - happy email sending.
at 1:06 PM 0 comments Posted by roni schuetz
Labels: asp.net, code sample, config
Friday, March 09, 2007
net use and error messages
the msdn bible contains everything:
System Error Codes
The following topics provide lists of system error codes. These values are defined in the WinError.h header file.
- System Error Codes (0-499)
- System Error Codes (500-999)
- System Error Codes (1000-1299)
- System Error Codes (1300-1699)
- System Error Codes (1700-3999)
- System Error Codes (4000-5999)
- System Error Codes (6000-8199)
- System Error Codes (8200-8999)
- System Error Codes (9000-11999)
- System Error Codes (12000-15999)
enjoy it.