HTML Hyphenation

There are two ways of hyphenation - with plain hyphen and soft hyphen. The plain hyphen is interpreted like a plain symbol, but soft hyphen is used only if it is necessary. The soft hyphen is represented by the character entity reference & s h y ; . This will solve many formatting problems like list text indent.

ASP.NET Using connection string from web.config in TableAdapters for Typed Datasets

To view this string the connection string tag must have: providerName="System.Data.SqlClient" (SQL Server). The string works also without this property but Visual Studio requires it to display existing connection string for datasets.

ASP.NET Exception Details: System.InvalidCastException: Unable to cast object of type 'ProfileCommon' to type 'ProfileCommon'.

SOLVED. It is a very strange issue. I have read many forums described this case. And the only way I found is:
1. Change web config line
profile defaultProvider="ProfileProvider" enabled="true"
to be
profile defaultProvider="ProfileProvider" enabled="false"

2. Save and refresh the web page.

3. Change web config line
profile defaultProvider="ProfileProvider" enabled="false"
to be
profile defaultProvider="ProfileProvider" enabled="true"

3. Save and refresh.

Strange but works.

ASP.NET - A simple way to change dinamically the css link

in the asp page we can make the link tag to be maintained from the server side
ink id="css" runat="server"  rel="stylesheet" type="text/css" 
and then we can change it dynamic
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (Page.IsPostBack) Then
End If
End Sub

This the easiest way to do it. Here is more complex css management in the Scott Gu' Blog:

Javascript - How to set and get cookie variable

This code searches for cookie value by key:

function get_cookie(Name) {
var search = Name + '='
var returnvalue = '';

if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
return returnvalue;

Setting cookie value:
document.cookie=key+"=" +value;

ASP.NET Managing url-s with examples


Request.ApplicationPath returns:






Request.Uri.MakeRelativeUri Method determines the differeneces between two Uri instances and returns relative path:
the relative difference is:

Request.Url.DnsSafeHost /Host


Request.UserHostName gets the DNS name










w3: A tool to troubleshoot client side issues.

HTTP Debugging Proxy:
It is good tool for analyzing http request by client side. You can view some errors that the server response don't show you.

Visual Studio 2005 - If there isn't Database Name File for Access database file

You have to change a registry key:


Underneath this key should be a sub-key called "ProgID" with a value of "MSIDXS.1". If you can't find this, it is causing the problem you are seeing. Adding this back should fix the issue.

Visual Studio - 'Unable to get the Project file from the Web server'

A solution to the 'Unable to get the Project file from the Web server' that has worked for us is to go into C:\Documents and Settings\(your user)\VSWebCache and delete everything in there."

Java Script - Closing window and reload the parent.

window.parent.close(); window.opener.location.href=window.opener.location.href;

if you want to do postback use this:

window.parent.close(); window.opener.__doPostBack('','')

Javascript - How to create navigation url for popup.

The popup don't have toolbar, statusbar and scrollbar.'" & Url & "',

ASP.NET - How to keep the user always logged in?

This functionality is natural extension of "remember me" which is part of Microsoft integrated Login Control. "Remember me" check box allow the user to stay logged in if he leaves the page or closes the browser.
But if you don't make a request for 30 minutes you will be logged out. The aim of "keep me logged in" is to hold the user logged in always until he clicks logout.

First you must change the forms timeout in web.config to be bigger than default value of 30 minutes - something like 300000. This guarantees that forms authentication ticket will live longer. This is enough to hold the user logged in for days.
"Remember me" check box makes the authentication cookie persistent and live even if you close the browser.
Users that are logged in without click checking remmeber me will stay logged in until they click logout or close the browser (authentication cookie is not persistent). If you want to specify a timeout for this user session you can do this:

1. Creating client cookie after logged in with value the session expiration time. Other way is to use Session state initiated by Session_Start(ByVal sender As Object, ByVal e As EventArgs).
You must change the session timeout in web.config to be equal or bigger than desired timeout and smaller than forms timeout.

2. Checking user authentication on every request in global.asax -> Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs). If user is autheticated and the timeout is expired you have to sign out and redirect to login form.
If the timeout is not expired you have to change the expiration time of the session like slide expiration of forms.
Be careful: Don't make client cookie to expire. This will make it persistent and closing the browser will not log out the user.