Monday, January 16, 2012
Remove the Lock Icon over a Folder in Windows 7
Tuesday, February 15, 2011
UNICODE ASP files are not supported Error solution
Active Server Pages, ASP 0239 (0x80004005)
UNICODE ASP files are not supported.
/cigna/default.asp, line 1
Solutions:
With your project open, click on File, Advanced Save Options. Select US-ASCII.
Then click to apply to ALL DOCUMENTS.
It will give you a warning that some characters may not play, but you can ignore that and click No.
From that point forward, all saves should be in ASCII and your pages will work fine.
Sunday, February 13, 2011
A semi colon character was expected - XML Error
XML Error: A semi colon character was expected. Error processing resource –
Error Description:
While viewing the xml file in a web browser, sometimes an error "A semi colon character was expected." Occurs.
Reason:
This occurs
1. When using external links on the XSLT sheet which contains the character “&”.
2. When there are html breaks in the content.
3. When there are quotes in the content.
Solution:
1. The work around is to simply replace every instance of & in the link with &
2. The work around is to simply replace every instance of html breaks with any symbol like semi colon ;
2. The work around is to simply replace every instance of single quote with "
Friday, February 11, 2011
Refresh or Reload parent window from child window
window.opener.location.reload();
Friday, February 4, 2011
Accessing parent window form elements
Syntax:
top.opener.document.forms[
This solution is cross browser compatible and works in all major browsers.
Sunday, January 16, 2011
Javascript pop up window focus
Give as below:
newwindow = window.open(url, "myWin", "width=600,height=400,toolbar=0,scrollbars=0");
newwindow.focus();
Thursday, December 23, 2010
Cookie transition between classic ASP and ASP.NET
I have a classic asp application that has a login module. There is another sub folder that has dotnet pages (.aspx). Any user who logs in to the asp application should be automatically able to view the .net pages too. But the aspx page was not able to access the cookie created in asp page. After a reasearch for some time i found out the reason why it was hapening like that.
Here is the reason:
My cookie name in the application is "cki_user". Point to be observed is the underscore symbol in the name. In classic ASP, the cookie name will be url encoded and created. That means, the actual cookie name will be "cki%5Fuser". But in asp.net, there will no url encoding hence the name remains "cki_user" when requesting. Hence i was not able to access the value. Finally i had to access it using Request.Cookies["cki%5Fuser"] which worked well.
Friday, December 3, 2010
9 Tips to write an Article
2. Most of the time, try to write an article in bullets or points...something like "10 ways to keep yourself fit".
3. Begin the article with an introduction on the topic or problem. If possible add your experiences.
4. Do not think too much on grammar while writing. Keep the grammar check job at the end.
5. Try to keep the article short.
6. Write the article in an informal way as if you are talking to your friend. That will make the reader feel easier to read.
7. Do a proofread after you are finished. Check for grammatical mistakes or any spelling mistakes.
8. Dont look at the article for one day. After a day, do a proofread again and check if you have put in everything that you wanted to.. in the article.
9. Now publish your article! DONE!!
Thursday, December 2, 2010
ASP.NET Pages not working on windows 64 bit server
Solution: Change the default app pool Identity to NETWORK SERVICE and allow all permission for NETWORK SERVICE on the website.
Note: Any new website that is created need to be given Full Control to NETWORK SERVICE in IIS.
Tuesday, November 3, 2009
Monday, July 13, 2009
Tips for Cross Browser Compatibility
1. All HTML controls in the page should have an ID attribute.
Example: <.... type="”text”" name="”txtname”" id="”txtname”">
2. Always use fixed width and height rather than percentages.
Example:
Fixed width: <.... width="”600”">......< /table>
Percentages: <.... width="”70%”">......< /table>
3. All the elements in the page should be bound in a proper html layout.
Example:
Correct: <..><..><..><..>< id="”test”">< /span>< /td>< /tr>< /table>< /body>
Wrong: <..><..><..><..>< /td>< /tr>< /table>< id="”test”">< /span>< /body>
4. Modal windows does not work properly in firefox. Use normal pop up windows instead.
Example:
window.open(....) works well in all conditions. ShowModaldialog does not work properly.
5. parent.dialogArguments does not work in firefox. Use parent.opener instead.
Example:
var strVals = parent.opener ? parent.opener : parent.dialogArguments;
strVals.callfunction()
6. While accessing html elements in javascript,
do not use document.forms[0].......Use document.getElementById(...)
do not use document.all(....). Always use document.getElementById(...)
7. window.event does not work in firefox. Instead we should pass the event to the calling javascript function and access using event.target.
Example:
< type="image" src="images/SFReset.gif" id="img2" name="img2" onclick="”ResetFields(event)”">
function ResetFields(e)
{
if (window.event)
var xButton = window.event.srcElement;
else
var xButton = e.target.name;
}
8. Automatic reload of the page does not work in some situations. Use Ajax in such cases.
9. SQL Reporting services reports frame width is height is shrinked in firefox.
To increase the frame height and width,
Go to Program Files → Microsoft SQL Server → MSSQL3 (Differs for different versions of sql server. Purpose is to locate Reporting Services folder) → Reporting Services → Report Server → Pages
Open ReportViewer.aspx
Add width and height attributes to the custom report viewer control.
Example: RS:ReportViewerHost width="1000px" height="860px" id="ReportViewerControl" runat="server">
10. semicolon in “nbsp;” is a must.
11. In javascript, use "getFullYear" whereever you use "getYear".
Tuesday, December 2, 2008
onkeypress not fired for Backspace and Delete
Here is a new thing that i have come across and wanted to share.
Scenario:
I was just experimenting to show the character count dynamically when a user types text in textarea. I have called a javascript function in onkeypress event of the textarea to calculate the count and put that in a html div element using innerHTML.
Observation:
onkeypress event does not fire for Back space and Delete keys in the keyboard.
Solution:
Use both onkeypress and onkeyup events and call the same function.
Saturday, October 4, 2008
Open a url in Kiosk/Full Screen mode
We can implement this by making configuration changes in window.open method of javascript.
Here is the sample logic:
window.open("sample.html","newwindow","fullscreen")
Monday, September 15, 2008
Browser detection in ASP
Request.ServerVariables("HTTP_USER_AGENT") will result in the following:
For IE:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
For Firefox:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Based on above, we can write below logic.
varBrowser= Request.ServerVariables("HTTP_USER_AGENT")
If InStr(varBrowser, "MSIE") > 0 Then
BrowserType = "IE"
Elseif InStr(varBrowser, "Firefox") > 0 Then
BrowserType = "FireFox"
End if
Saturday, September 13, 2008
Recordset GetString() method
This method can be used to fill HTML tables in ASP files.
You can find the details of the method in the below link:
http://www.w3schools.com/ADO/met_rs_getstring.asp
Saturday, June 14, 2008
Generate HTML dynamically in javascript
Suppose you want a textbox control to be added each time in an on click event of a hyper link,
Onclick javascript function:
You can use this logic according to your requirements.
Friday, June 13, 2008
To check and uncheck a radio button
Logic 1:
Add below code to the control
onclick='this.chk = this.chk ? this.checked = !this.chk : this.checked'
OR
Explanation:
A property by name "chk" is created to "this" object and is assigned the value of standard "checked". It stores the current state of the radio button. Based on this we check and uncheck the radio button. (You can use any name in place of "chk")
Logic 2:
Explanation:
Declare a global variable and set it to null initially. Call this function in the radio button control onclick event and pass "this" as parameter. When radio button is checked for first time, the if condition is true and hence it is checked. The global variable's value is now changed. Now when you check the radio button, if condition is false and hence else part is executed where radio button checked property is set to false. Here, global variable's value is again changed. This way, the radio button gets checked and unchecked alternatively.
Tuesday, May 27, 2008
Paging in ASP
Rs.Open sql,Conn,3,1 //here 3 is cursor type and 1 is lock type. cursor type is static and lock type is readonly
If not(Rs.eof and Rs.bof) then
//initialize paging requirements
Pagesize = 5 //set page size to a variable
Page = request(“page”) //get the current page no into a variable
If Page = “” then Page = 1 //if this variable is null that means it is first page
Recordcount = Rs.recordcount //get no. of records in Rs
Rs.pagesize = Pagesize //assign page size to Rs
Rs.absolutepage = Page //current page no. assigned to Rs
TotalPages = Rs.Pagecount //get count of total no. of pages
Prev = Page – 1 //Previous page no. set here
Next = Page + 1 //Next page no. set here
Count = 1 //initialize count variable to 1
//open the while loop of the result set
While not Rs.eof and Count <= Pagesize //Here, looping is restricted to the page size that we have set
………………………..
//increment count variable
Count = Count + 1
//close loopWend
//At the bottom of the page, provide links for paging
Print a page
How to eliminate the unnecessary things from printing?
// Declare the style in a style sheet
.noprint
{
DISPLAY: none
}
//include the external style sheet in the page
//Put the div tags with class=”noprint” in the page wherever required
Send Mail
//Declare mail object
Set objPersits = Server.CreateObject("Persits.MailSender")
With objPersits
.From = "sree@yahoo.com" //From Email Id
.FromName = "Sree" //Name of the Sender
.Host = "mail.domain.com" //Mail Host
.Subject = "Invitation"
.AddAddress mailTo,mailName
.Body = mailbody
.isHTML = True //If html content exists in the mail body
on error resume next
.Send //To send mail finally
if err.number <> 0 then
response.write "Error " & err.number & " sending to " & mailTo & " (" & mailName & ")"
//To know the description of the error, we give
response.write err.description
err.clear
else
//Mail has been sent
end if
.RemoveAddress mailTo, mailName
End With
set objPersits = nothing
How to send an external html file through mail?
//Declare file system object to read from the file
set fso = Server.CreateObject("Scripting.FileSystemObject")
//Specify File location
fname = "/AffiliateEmails/affmail.htm"
//Open a file using above object and set it to a new object
set fObj = fso.openTextFile(server.mappath(fname))
//Read from the file and assign to a variable which is further assigned to the .Body of the mail
mailBody = fObj.readAll
//Close the connection to the file
fObj.close
set fso = nothing