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";

JSP (Java) Redirect
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/"

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

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

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;

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

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

30.8.2009 16:43:40 - Filed under : C# | Asp.net | CSS | AJAX
Implementing the HTTP header is beneficial if a site owner wants most of their site to render as it did in IE7 or if there are no plans to update site content. Inclusion of this header honors any Quirks mode pages that belong to the site. Use below statement at top of your page :
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
or use it in web.config :
            <add name="X-UA-Compatible" value="IE=EmulateIE7" />
Using the meta-tag on a per-page basis is beneficial when the publisher wants to opt-in specific pages to render as they did in IE7.

NOTE: The X-UA-Compatible tag and header override any existing DOCTYPE. Also, the mode specified by the page takes precedent over the HTTP header. For example, you could add the EmulateIE7 HTTP header to a site, and set specific pages to display in IE8 mode (by using the meta-tag with content=”IE8”).

Using the IE=EmulateIE7 compatibility tag is a simple way for users to continue their current experience when browsing your site until you can update with more standards-compliant content.  Although adding this tag will prevent most display issues, you may also need to update your site to properly detect IE8.

Keywords : Emulate IE7
with 0 comments

Previous | Next
Current Page: 1