|
How to make a textbox not accept certain words?
Example : can not contain word "dog" in a string
I hv tried negative lookahead (?!regexp) and many other method i found through google, but none of them work. I'm using RegularExpressionValidator in VS 2003. Izzit related?
-- modified at 2:01 Wednesday 27th September, 2006
|
|
|
|
|
|
Anyway, Thx for your help.
But i'm quite new to regular expression. I still not sure what to put. Appreciate if someone can give me the solution. Thx
|
|
|
|
|
It depends what exactly you want your user not to put in the textbox. I hope it won't be "dog" as you mentioned.
Best Regards,
Apurva Kaushal
|
|
|
|
|
haha, it just an example.
Finally i found the solution.
^((?!(illegal)).)*$
but regular expression is case sensitive. that's mean words like "illegAL" will not work... i think i better use back the .net code... anyway, thx ..
|
|
|
|
|
|
Hi there
guess this is a helpful link
[^]
it contains many useful information about regular expressions.
Best Regards
3ala2
|
|
|
|
|
Hi,
In our asp.net 1.1 application client has told us to maintain one session per application means only one user can login at a time and if another user tries to login then we should tell that user that another user has already logged in. So all these things i finished doing but i am facing a problem when user closes the window directly without bieng logging out and the default session timeout is about 20 minutes so if a user has closed the window another user cannot login for another 20 minutes till the session expires.
So to avoid this using javascript i have written a function which will execute onbeforepageload event which will post to the login page with a querysting parameter which tells that the user has clicked the logout button and i am ending the session of that user. This is working fine for the close window but also it is getting executed when we refresh the page. through some javascript coding i got succeede to avoid the F5 refresh but we have to avoid even others options of refresh also. and we cannot disable those options.
hope you have understood my problem. So can anybody please help in this matter how to solve this problem.
Thanks in advance
Syed Saleem
|
|
|
|
|
The easiest way what I feel is to use Meta information and get the trick working. Consider we have a page WebPage.aspx add the below code in the the WebPage.aspx.cs file.
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 60) + 5));
if(Session[“IsUserValid”].ToString()==””)
Server.Transfer(“Relogin.aspx”);
}
In the above code, The WebPage.aspx is refreshed after 5 seconds once the Session is expired. And in the page load the session is validated, as the session is no more valid. The page is redirected to the Re-Login page. Every post-back to the server will refresh the session and the same will be updated in the Meta information of the WebPage.aspx.
|
|
|
|
|
Thank you very much for your reply and sharing your precious time in solving me problem. Please see the description below what actually i am doing in the code and help me.
Actually when the user closes the window(browser) directly without logging out i am killing the user session by executing a javascript function as follows:-
var code;
function getKey(keyStroke) {
// keycode for F5 function
if (window.event && window.event.keyCode == 116) {
//window.event.keyCode = 8;
code=window.event.keyCode;
return true;
}
}
function closeIt()
{
if (code != 116)
{
window.location.href="Default.aspx?action=logout";
}
}
the above javascript function im calling by the following way:-
as when the window will be closing onUnload event and onbeforeunload events will be fired, so in onbeforeunload event i am calling a function CloseIt() which will set the location reference of the page to the Default.aspx which is an login page and there i am checking for the querystring parameter "action" with the value "logout" then i am killing the users session. But the problem is that the onbeforeunload and onunload events will be fired even when we refresh the page. Some how i got succeede to avoid the F5 key as u can see the code above by taking the key of F5 key.
i have already added the line of code you have mentioned:
Response.AppendHeader("Refresh", Convert.ToString(Session.Timeout * 60) +"; URL=Default.aspx?action=logout");
the above line of code will redirect the page to the login page automatically when session expires.
But my problem here is to kill the user session when the user closes the window without logging off and when i am trying to kill the session in the onbeforeunload event of javascript it is even killing the session when we refresh.
So please help me in this how can i over come this problem. Is there any javascript event which will distinghiush window close and refresh. if any please let me know.
Thanks in Advance
Syed Saleem
|
|
|
|
|
That is how I solved the problem. It is working very well.
// Catch window closings and logout
window.onbeforeunload = function(){
if((window.event.clientX<0) || (window.event.clientY<0)) logout();
}
function logout()
{
location.href ="adm_logout.asp";
}
|
|
|
|
|
We are developing (trying at least) a processes where we want to call another form and pass some variables from the calling form to the called form. We are trying to figure out how to make sure that the fields ( one field is static, and the other could be one of 4 different fields) we are passing and the form we are calling match up. We want to get current information from one system (the system we are going to) and then retrieve back the updated information and have it display? How can I find out what the ? and & in the href mean? if we want to pass an id to form update do we do a
http://www.xxxxxxxx/update.jsp?id=12738"
once we have the informatin how can we refresh to display the new information?
marsha
|
|
|
|
|
Does anyone know where I might find a script that creates a rotating image sphere? I found a site that utilizes a java applet to do so, but I'd prefer javacript instead. I'd like to point it at images and have it create a rotating sphere composed of the images.
I might have to make my own, but my math isn't that good!
|
|
|
|
|
Javascript isn't suited for doing something like that. Even if you manage to get the image data, and even display the image data, it would take minutes to calculate each frame, so it wouldn't really be rotating as much as moving ocassionally...
---
b { font-weight: normal; }
|
|
|
|
|
I think it could be done without being that resource intensive, with the right knowledge. I've got a fairly simple script on my homepage that scrolls images.
|
|
|
|
|
Scrolling images is extremely trivial in comparison. There is no processing of the image data required for that. For a spherical distorsion of an image, on the other hand, you would have to calculate every pixel of the image.
---
b { font-weight: normal; }
|
|
|
|
|
I need guidence regarding creation of PERT/CPM chart using technology ASP/PHP/VB script.
can anyone please help me on this
Any help would be appreciated.
Thanks in advance
Himanshu Sharma
|
|
|
|
|
Hi,
I have an activex which is just a report list control. Whenever I resize the IE the page gets scroll bars. If I scroll the IE page scrolllbars the Activex does not get repainted & it shows some other pages contents.
So what should I do to avoid it & ask activex to get repainted. Plz help
Thanx & Regards,
Vinod.
|
|
|
|
|
:-OSample coding for add a password to save button using asp.
NI
|
|
|
|
|
What?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi Folks,
Any help for this issue would be appreciated.
Am trying to move a file from a soruce to destination folder in the following steps :
1)Check if destination directory exists [Directory.Exists(path)].. Else, create one.
2)DiretoryInfo di=new DirectoryInfo(sourcePath);
3)FileInfo[] fi= di.getFiles("TAX");
4)Foreach FileInfo
{
FileInfo.move(source, destination);
}
So, am getting an error right after the first step and error is "Second path fragment must not be a drive or UNC name. ".
Any ideas please?
Thanks,
RB
|
|
|
|
|
You have posted your question in the wrong message board. This has nothing to do with web development. You should post it in a programming language specific board.
---
b { font-weight: normal; }
|
|
|
|
|
Try this
DirectoryInfo di=new DirectoryInfo(sourcePath);
FileInfo[] fi = di.GetFiles();
foreach(FileInfo f in fi)
{
f.MoveTo(destination);
}
Hope this solves your problem.
Luck is Opportunity with hardwork
|
|
|
|
|
Hi there
code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions????
dim rsRandom,sqlRandom<br />
set rsRandom = Server.CreateObject("ADODB.Recordset")<br />
sqlRandom = "Some query" <br />
rsRandom.open sqlRandom,conn,3,3<br />
response.write(rsRandom.recordCount)<br />
<br />
thanks in advance
|
|
|
|
|
That means that the recordset doesn't support random access to the rows but only sequential access. The RecordCount property doesn't work as the recordset doesn't know how many records there are. It's probably because you use a different database driver on the live server.
---
b { font-weight: normal; }
|
|
|
|