Karatas, FERHAT
I would love to change the world, but they won't give me the source code!
301 Redirect
8.9.2009 12:08:59 - Filed under : Asp.net | Misc | SEO
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".
Domain aliases is usually considered spamming to the search engines because the domain name DUPLICATES the content on your primary domain and in turn, masks the domain name under the secondary domain. They may feel you are trying to trick them when you use a domain alias. Because what they see when they crawl an aliased domain is a website domain that has exactly the same content as the primary domain.

You can Test your redirection with Search Engine Friendly Redirect Checker

Below are a Couple of methods to implement URL Redirection

IIS Redirect

    * In internet services manager, right click on the file or folder you wish to redirect
    * Select the radio titled "a redirection to a URL".
    * Enter the redirection page
    * Check "The exact url entered above" and the "A permanent redirection for this resource"
    * Click on 'Apply'

ColdFusion Redirect
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">

PHP Redirect
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
%>

ASP .NET Redirect
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script>

JSP (Java) Redirect
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
%>

CGI PERL Redirect
$q = new CGI;
print $q->redirect("http://www.new-url.com/");

Ruby on Rails Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end

Keywords : 301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. Do not use "domain alias" for URL redirection.
with 0 comments

Delay redirect in javascript
7.9.2009 10:45:31 - Filed under : Asp.net | Javascript
<script type="text/javascript">
    function delayedRedirect(CategoryID){
        window.location = "../Detail.aspx?" + '&CategoryID=' + CategoryID
    }
</script>

ClientScript.RegisterStartupScript(this.GetType(), "redirect", "setTimeout('delayedRedirect(" + Request.QueryString["CategoryID"] + ")', 3000)", true);

Keywords : Redirection with javascript

with 0 comments

Gmail apps for Email hosting
6.9.2009 12:14:08 - Filed under : Asp.net | Misc
I'll show you how to tranfser your mail server (MX) to Google Apps.

Step 1/2 : Changing MX records (with plesk panel)
- Select your domain
- Select "DNS Settings" in Services section
- You will see 12 records. Delete only this record :     
  yourdomain.com.    MX (10)        mail.yourdomain.com.
- Add these records.(with Record Type = MX)
  Note : "Enter mail domain" is blank

 Enter mail exchanger        Specify priority of mail exchange server
 ASPMX.L.GOOGLE.COM.         10
 ALT1.ASPMX.L.GOOGLE.COM.     20
 ALT2.ASPMX.L.GOOGLE.COM.     20
 ASPMX2.GOOGLEMAIL.COM.     30
 ASPMX3.GOOGLEMAIL.COM.     30
 ASPMX4.GOOGLEMAIL.COM.     30
 ASPMX5.GOOGLEMAIL.COM.     30

Step 2/2 : Sign-up google apps
You should create your account with this url : http://www.google.com/apps/intl/en/group/index.html
Confirm your membership with mail that sent by goggle apps.

Optional :
Configuration for Outlook :
incoming : pop.gmail.com
smtp     : smtp.gmail.com
More settings :
Outgoing Server - My outgoing server(SMTP) requires authentication
Advanced - Incoming server (POP3) : 995
This server requires an encrypted connection (SSL)
Outgoing server (SMTP) : 465
Use the following type of encrypted connection : SSL

Note : You can access your inbox at http://mail.google.com/a/yourdomain.com

Keywords :  Gmail apps configuration/implementation/installation
with 0 comments

ChangePassword control with Gmail Apps
5.9.2009 18:07:08 - Filed under : C# | Asp.net
BUG: ASP.net 2.0 PasswordRecovery/ChangePassword Web Control cannot send emails to SSL enabled SMTP Servers

This is a known issue or you can also call it as product limitation. PasswordRecovery or ChangePassword control read most of the settings from web.config file. Internally it uses System.Net.Mail to send out email, which does not support reading EnableSSL setting from web.config. This bring us into a situation where PasswordRecovery control cannot send emails to SSL enabled smtp servers.

So when a user tries to send a email to SSL enable server using PasswordRecovery or ChangePassword control, he get the following error.

Error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. 32sm15616652wfa.13
Cause :
There is no setting in Web.Config for System.Net.Mail (.net 2.0) that maps to EnableSSL property of System.Net.Mail.SmtpClient.
Resolution :
Step 1 : Add SendingMail event to control;

<asp:ChangePassword ID="ChangePassword1" runat="server" onsendingmail = "ChangePassword1_SendingMail">


Step 2 : Add codebehind codes;
protected void ChangePassword1_SendingMail(object sender, MailMessageEventArgs e)
        {
            e.Message.Body.SendMail(e.Message.To[0].ToString(), e.Message.Subject.ToString(), string.Empty);
            e.Cancel = true;
        }

Step 3 : SendMail (extention) method;
public static void SendMail(this string body, string to, string subject, string attachFilename)
        {
            Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
            MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
            string from = mailSettings.Smtp.From;

            MailMessage message = new MailMessage();
            message.Priority = MailPriority.Normal;
            message.From = new MailAddress(from, ConfigurationManager.AppSettings["SiteName"]);
            message.To.Add(new MailAddress(to));
            message.Subject = subject;
            message.IsBodyHtml = true;
            message.SubjectEncoding = Encoding.UTF8;
            message.BodyEncoding = Encoding.UTF8;
            message.Body = body + "<br><br>" + ConfigurationManager.AppSettings["SiteDomain"] + "<br>" + DateTime.Now.ToString();

            if (attachFilename != string.Empty)
            {
                message.Attachments.Add(new Attachment(attachFilename));
            }

            SmtpClient client = new SmtpClient();
            client.EnableSsl = true;
            client.Send(message);
        }

Step 4 : Add smtp node to web.config;
<system.net>
  <mailSettings>
    <smtp from="sample@yourdomain.com" deliveryMethod="Network">
    <network host="smtp.gmail.com" port="587" userName="sample@yourdomain.com" password="xxxx" defaultCredentials="false"/>
    </smtp>
  </mailSettings>
</system.net>
<system.web>...

Keywords : Gmail apps with ChangePassword control in asp.net
with 0 comments

Property IsLocked is not available
4.9.2009 10:40:49 - Filed under : SQL
Property IsLocked is not available for Login '[DBName]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

Solution 1 : Restart computer

Solution 2 :
I ran into the same issue today when I installed an instance of SQL 2005 using Windows Auth. mode.  After the install I switched the server over to SQL and Windows Auth mode and ran into the 'sa' problem.  I ran the following command and then could see the properties of 'sa' within management studio.
alter login sa
with password = 'yourpwd' unlock,
check_policy = off,
check_expiration = off

Keywords : Sql login, islocked, insufficient
with 0 comments

Previous | Next
Current Page: 1