|
Your best solution would be not to automatically redirect 404 errors and then handle it properly on the URL that was requested. If you have no choice but to redirect then you could try accessing the referrer variable (access to which is dependant on your language - in PHP try $_SERVER) to discover where the page was referred from.
|
|
|
|
|
Hmm... I can get the referrer in javascript using document.referrer but it displays the page that the link came from (eg index.htm links to ihasabucket.htm) then all we see is index.htm
I think I might talk to my web host about letting my .htaccess file handle 404 errors. Thanks anyway!
|
|
|
|
|
Hi
How can we prevent Search Engines Caching or indexing on our websites?
Thank you.
|
|
|
|
|
a robots.txt file.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thank you.
But I couldn't figure out.
Please explain more.
|
|
|
|
|
I'm sorry, I thought you may live in a country that has google. A robots.txt file lists the directories that a search engine should ignore and is placed in the root.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
|
So, I have to update my company website. I worked on it extensively while I was away. The new design calls for two frames, with all the links in the top frame, which then cause pages to appear in the bottom one. So, I have a method like this:
function
navigateFrame2(path, id)
{
if (parent.frames.length > 1)
{
clearStyles();
var el = document.getElementById(id);
if (el)
{
el.style.fontWeight =
"bold";
}
// parent.frames[0].location = "header.aspx";
parent.frames[1].location = path;
}
return false;
}
and links like this:
<
a class="menuLink" runat="server" href="javascript:void(0);" onclick="javascript:navigateFrame2('iPhone.aspx', iPhoneId);" ID="iphone" style="padding 5 0 5" >iPhone/iPod</a> |
This all worked great in IE6. In IE7, a couple of my pages come up fine, but the rest either do not come up, come up after I've clicked the link a few times ( only one page does this ), or appear only to disappear again in a split second. When I right click on the lower frame, and view source, the source is there, and if I save it as a html file, IE7 can view it. If I open two pages in two tabs, then if I go to a link in my page, go to the other tab, then go to another program, and back, and click the tab, the page is shown. So, it appears to be some sort of rendering bug ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi:
In my project for "Change Password Module" i am implementing following Logic:
1) User will Enter the OldPassword,NewPassword,Confirm Password then i am checking wether the Old Password is exists
2)If the OldPassword Exists I am setting Customvalidator =true and Maintaining session value=1
3)Now i am calling the session value in "Accept" buttonClick event in which i am cheking wether the session variable is one"
4)If the value is one, the Newly entered password will be updated otherwise Error message will be displayed.
The issue is session variable should not be used .Instead of session alternative method should be used.Can any one send me code for Change Password without using session variable.
I have mentioned the code below.
My code:
**************************Presentation Layer****************************
/// <summary>
/// Update The password
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void imgaccept_Click(object sender, ImageClickEventArgs e)
{
try
{
if (Page.IsValid == true)
{
if (Convert.ToString(Session["Validapassword"]) == "1")
{
Hashtable Has_PWDupdate = new Hashtable();
//Adding Values into Hashtable
Has_PWDupdate.Add("username",Session["UserName"].ToString());
Has_PWDupdate.Add("password", DAMS_Cls_EncryptDecrypt.Encrypt(txtNewpassword.Text));
ChangePWD.ChangePassword(Has_PWDupdate);
string strScript = "";
string strPath = "HomePage.aspx";
strScript = strScript + "<script language='javascript'>";
strScript = strScript + "alert('Your password successfully changed.');";
strScript = strScript + "window.location.href='" + strPath + "';";
strScript = strScript + "</script>";
ScriptManager.RegisterStartupScript(this, Type.GetType("System.String"), "Message", strScript, false);
}
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// If CancelButton is Clicked,Page will be redirected to the Changepassword Page
/// </summary>
/// <param name="source">The source.</param>
/// <param name="arg">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
protected void CheckSelectedStateValue(object source, ServerValidateEventArgs arg)
{
try
{
bool oldPasswordExist;
//Check for UserName and Password Valid
Hashtable has_pwdChange = new Hashtable();
has_pwdChange.Add("username", Session["UserName"].ToString());
has_pwdChange.Add("OldPassword", DAMS_Cls_EncryptDecrypt.Encrypt(txtOldPassword.Text));
oldPasswordExist = ChangePWD.CheckOldPassword(has_pwdChange);
// Check for oldPasswordExist
if (oldPasswordExist == true)
{
arg.IsValid = true;
//If oldPWD is Exist Then Value '1' is Assign to the Session Variable "Validapassword"
Session.Add("Validapassword", 1);
}
else
{
arg.IsValid = false;
}
}
catch (Exception ex)
{
throw ex;
}
}
***************BusinessLogic Lyer********************
/// <summary>
/// Change Password
/// </summary>
/// <param name="Has_PWDupdate"></param>
public void ChangePassword(Hashtable Has_PWDupdate)
{
try
{
Hashtable hsh = new Hashtable();
hsh.Add("@UserName", Has_PWDupdate["username"].ToString());
hsh.Add("@Password", Has_PWDupdate["password"].ToString());
DAMS_cls_DataAccess.ExecuteCommand("DAMS_SP_Password_Update", hsh);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Check Whether Old Password is Exists
/// </summary>
/// <param name="CheckOldPWD"></param>
/// <returns></returns>
public bool CheckOldPassword(Hashtable CheckOldPWD)
{
try
{
Hashtable hsh = new Hashtable();
hsh.Add("@UserName", CheckOldPWD["username"].ToString());
bool isExist = false;
SqlDataReader drDAMS_PWDchange;
drDAMS_PWDchange = DAMS_cls_DataAccess.GetDataReader("DAMS_SP_IsOldPasswordExist", hsh);
//Check for row Count
if (drDAMS_PWDchange.HasRows)
{
//Read The UserName in datareader
while (drDAMS_PWDchange.Read())
{
if (drDAMS_PWDchange.GetValue(0).ToString() == CheckOldPWD["OldPassword"].ToString())
{
isExist = true;
}
else
{
isExist = false;
}
}
}
return isExist;
}
catch (Exception ex)
{
throw ex;
}
}
suresh
|
|
|
|
|
You should call your DB to change the DB and return a value telling you if the old password was right or not.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You can simply use ViewState
|
|
|
|
|
NEVER put login or other security info into viewstate unless you are sure no-one will ever care enough to break into it. Or you hate the people you work for.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi.
I have a table , Like this :
<table id="MDS_Table">
<tr>
<td>sth</td>
<td>sth</td>
</tr>
<tr>
<td>sth</td>
<td>sth</td>
</tr>
<tr>
<td>sth</td>
<td>sth</td>
</tr>
</table>
How can I change background color of all <td> with javascript ?
Thanks in advance.
|
|
|
|
|
Brute force:
var cells = document.getElementsByTagName("TD");
for (var i=0; i<cells.length; ++i)
cells[i].style.backgroundColor="orange"; Or some smart use of CSS:
<style>
table.orangeCells { background-color: orange; }
</style>
...
document.getElementById("MDS_Table").className = "orangeCells";
---- You're right.
These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets .
|
|
|
|
|
Thank you Shog9.
I used :
var table = window.document.getElementById('MDS_Table').getElementsByTagName('TD');
for (i=0; i < table.length; i++)
table[i].style.backgroundColor = '#af3830';
|
|
|
|
|
Hello
I am very new to all of this so I'm expecting to be made fun of if this is very obvious.
I am using a script to show a basic flash video on one of my pages. I would like to add a few other videos in the same place, with only one of them playing any time the page is viewed or refreshed.
I am using a GoDaddy page designer and the video is hosted at a different site that simply provides me with an "embed code" to paste in my page editor. I am hoping for a simple code that will allow me to plug in a few different "embed codes" from my videos and solve my problem.
I'm sure there is a simple code that will randomly select only one of the flash files to be displayed.
I would imagine this could apply to something like images, backgrounds, or any other type of file.
Can someone provide me with a code that accomplishes this?
Thanks
modified on Wednesday, October 1, 2008 3:21 PM
|
|
|
|
|
|
Thanks Richard
This is where I am completely out of my element. It looks like you may be right in that SWFObjects could solve my problem, however I have no idea as to where to start to create one.
I should have been more specific about how ingrorant I am to all of this. I am using a GoDaddy page designer and the video is hosted at a different site that simply provides me with an "embed code" to paste in my page editor.
I am hoping for a simple code that will allow me to plug in a few different "embed codes" from my videos and solve my problem.
|
|
|
|
|
Hi
I am trying to use client-side JavaScript to copy a local file across to the web server. What is the best way to build up the target string? If I hard code to path it works fine, but if I build up a string dynamically I get a "Bad file name" error using FSO CopyFile method.
Thanks, Ken.
|
|
|
|
|
Any spaces in the path? Try putting it in double quotes eg.
"c:\program files\myfile.txt"
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Well sorry to waste your time. Ive since been advised that trying to use client-side FSO through ActiveX raises all kinds or security issues. As its a dot net web app, I'll have to revert to using a asp control to upload the file then do a postback behind code.
Cheers.
|
|
|
|
|
True enough, but I assumed you would take that into account. Anyway, no problem.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi
Im trying to show a PDF as the response of asn aspx. For this is i'm doing the following.
" Response.ContentType = "application/pdf";
Response.Buffer = true;
Response.Clear();
Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
Response.OutputStream.Flush();
Response.End();
"
But the page is coming as a plain text as "%pdf-1.4@#....". When i try to see the content-type for the response using HTTPWatch tool i could see that its coming as "text/html ; charset: UTF-8"
The same page when is loaded in an IFrame is rendered properly as a PDF. But Iframe is not acceptable as per the needs.
Please help me in this issue.
Thanks and Regards
KC
|
|
|
|
|
Hi,
I found out that my httpmodule is blocking the rendering of this page as a PDF.
May i know the solution for this?
|
|
|
|