|
Hi,
hi i am new in asp.net.
I have problem that at the time of using website if i press backspace key then it shows the previous page, i want to an alert message if user press backspace key at the time using website...
thanks
|
|
|
|
|
Use the following JS function
function checkBackSpace()
{
if(event.keyCode==8)
{
alert('You pressed BackSpace');
return false;
}
}
and put it on body tag as
<body onkeydown="return checkBackSpace();">
Now you will get a message.
Cheers!!
Brij
|
|
|
|
|
I think Brij is right. But a little changes are required in this code. Otherwise it will alert when user hits backspace key in a textbox. So here is the answer below
In JS code
---------------------
function checkBackSpace(event)
{
event = event || window.event;
var target = event.target || event.srcElement;
if(event.keyCode==8 && (!(target.type =="text" || target.type =="textarea"))
{
alert('You pressed BackSpace');
return false;
}
return true;
}
and put it on body tag as
-------------------------------
<body onkeydown="return checkBackSpace(event);>
Cheers
Prosanta
|
|
|
|
|
Thanks for your update.
Cheers!!
Brij
|
|
|
|
|
thanks a lot you both Brij and Prosanta...
|
|
|
|
|
hi its working but there is some error when i navigating using tab key....
it throughs error related object...
why? how i handle it?
|
|
|
|
|
Hi
here is your code below
function checkBackSpace(event)
{
event = event || window.event;
var target = event.target || event.srcElement;
if(event.keyCode==8)
{
if((!(target.type =="text" || target.type =="textarea"))
{
alert('You pressed BackSpace');
return false;
}
}
return true;
}
Cheers
Prosanta
|
|
|
|
|
Please follow the story, I don't think there is much more to get to the bottom of this problem just need some more ideas...
ASP.NET Problem
theLizard
modified on Sunday, January 17, 2010 5:32 PM
|
|
|
|
|
For those that want to know.
The problem was not my application as I knew all along, the problem turned out to be how the initial page was called in the various browsers.
If I omitted the www. of default.com/mypage.aspx the Session ID was created for mysite.com/default.aspx but when I called the response page via the call back, the window.location.url redirected to www.mysite.com/responsepage.aspx a new session was started with new session objects resulting in the strange behavior.
To those who answered, thanks your input did help in pointing me in the right direction.
theLizard
|
|
|
|
|
Hi,
I'm trying to embed an ActiveX control in a website developed using the Sharp (S#arp) Architecture Framework[^], which leverages the ASP.NET MVC Framework & NHibernate. However, I'm struggling to get it to work.
Is it possible to embed an ActiveX control?
I'm also thinking of an alternative, where I could add a Web form to the project & that could contain the ActiveX. (I suppose it should work). Any alternative ideas if its not possible to embed an ActiveX control in a ASP.NET MVC view?
Thanks,
ND
* Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *
|
|
|
|
|
Hi, you should check IIS: the upper limit of thread, then check whether you have closed every transaction in your code or not.
Good luck.
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:53am.
|
|
|
|
|
i have upload a website which run fine but it upon show an error message which show that page cann't b displayed due to high trafic while there are only 15 to 20 user accessing the sites.
amirzada
|
|
|
|
|
This is a performance issue.Monitor the performance of your application/webserver,then you'll get to know the actual issue.
You can also refer Click hereCheers!!
Brij
|
|
|
|
|
i have check ur solution but it does not work. the message is shown when three people are accessing the site often it shows the message when there are only two users.
amirzada
|
|
|
|
|
Is it reasonable to put my objects into the Session between pages. I have reduced my objects to fairly small size with no lists or collections, generally between 4 and 10 fields. I am currently pushing these into the Session object assuming that this is quicker than a trip to the database (and will it piss off the host DiscountASP.net).
What is the recommended method of transferring IDs between pages, I am currently using the URL but I know this is not good as it exposes details about the system that should not be exposed
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Transferring id values is OK so long as they are secured otherwise, ie if you use id=7 a user can't type id=8 and get that id unless they have permission. Often you can use post parameters to "hide" the information from the user but the security still needs to exist.
While it is very reasonable to put some objects in Session I prefer hitting the db and having completely stateless ASP.NET applications. Any host that doesn't want you using their DB has problems.
Also, one pattern I use when using Session is to have a SessionManager class and I require that all access to properties in the Session be from that class. That way it is easy to see what is in the Session and Where, etc.
|
|
|
|
|
Mycroft Holmes wrote: I have reduced my objects to fairly small size with no lists or collections, generally between 4 and 10 fields.
Looks fine to me. Make sure you remove them once you are done and your session don't have huge timeout limits. Performance will impact badly only when site has got huge traffic. In all other cases, it should be fine.
Mycroft Holmes wrote: What is the recommended method of transferring IDs between pages, I am currently using the URL but I know this is not good as it exposes details about the system that should not be exposed
If Ids are secured, don't pass it through URL. If not, passing through URL is fine. It will produce hackable URLs and hackable URLs are very helpful.
Best wishes,
Navaneeth
|
|
|
|
|
N a v a n e e t h wrote: If Ids are secured,
Can you elaborate on securing the IDs, currently they are simply integers (?CustomerID=1) in the URL
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Can you elaborate on securing the IDs
Well, if you are sending secured information through URL, few things should be taken care.
- Encrypt the values and send the encrypted text. The encrypted text may have special characters and you probably have to encode it before using in URL.
- A second level of check should be performed after you receive the id. For example, you have a page that allows editing personal information of current user with a url like (
edit.aspx?id=20 ) where 20 is the current user's id. Since the id is clearly visible, a user can change it to 30 and edit that users personal information. So after receiving the id, you need to check whether the current user logged in has the same id specified in the URL. It is good to do this second level of checking even the values are encrypted. After all, if you can, avoid passing secured information through URL.
Best wishes,
Navaneeth
|
|
|
|
|
And this[^] article has some explanations too.
Best wishes,
Navaneeth
|
|
|
|
|
Thank you - isn't it wonderful when you can point to one of your own articles to meet someones needs. Have 5 here and there
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
True. It's a wonderful feeling.
Best wishes,
Navaneeth
|
|
|
|
|
Analyse the data what you can put in Cache or in Session.If there is some global data that is common for all users,put it in Cache and put Data which is specific to user those put it in Session only.It will improve the performance.
When passing IDs through URL,encode it and decode it at the recieving end and validate it.
Cheers!!
Brij
|
|
|
|
|
Brij wrote: When passing IDs through URL,encode it and decode it at the recieving end and validate it.
Can you define encode/decode in its simplest form please
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Encode: means you are changing the actual value to different value using some pattern/value
Decode: means get the actual value from the encoded value.(You can get the actual value because you have the pattern/formula for encoding but no other person can get the actual value).
Cheers!!
Brij
|
|
|
|