|
I have a Admin folder that I have secured with the Asp.Net Configuration page. I am using the Login control to grant access to admin users.
The whole thing has worked fine on my machine, but I've just ftp'ed all my files to a web hosting site and the Login no longer works.
I know the problem is due to an incorrect connection string but the Login control does not provide a mechanism for changing it. So, how do I tell the Login control to point to the database on the web host?
Any help would be greatly appreciated! (By the way, I've spent two hours on google before posting this message)
If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.
|
|
|
|
|
From your description is sounds like you need to update the Web.config file with the correct connection string. Have you already looked there?
|
|
|
|
|
Yes I have.
If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.
|
|
|
|
|
Did you also check the web.config found in the admin folder? That's the most likely place to find the errant connection string. Is your connection string encrypted or open text in the web.config?
|
|
|
|
|
I finally figured it out. The solution lies in the secured folder's web.config file. The following tags replace the default Login connection with a specified connection:
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="server=216.26.169.23;
database=ASPNETDB;uid=midwest;password=qazwsx1234;"/>
</connectionStrings>
Thanks for the willingness to help! (Now where is all that hair that I pulled out?)
If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.
|
|
|
|
|
ElseIf strTimeFormat = "HHMMAMPM" Then
Dim Format1 As String = "(1[0-2]|[1-9])([0-5][0-9])*(a|p|A|P)(m|M)"
Dim TryValidateFormat1 As New System.Text.RegularExpressions.Regex(Format1)
Return TryValidateFormat1.IsMatch(strTimeValue)
The above is my code to validate time.
This works fine in most of the senario but breaks in this kind
eg:
if i give input as 0859PM this works good.
if the data is xxxxxx649PM /AM it does not validate it. instead it says validation passed but it should fail actually.
can any one help me in this.
cheers
chandu
|
|
|
|
|
Good Morning,
I am trying to write a simple time out javascript to accompany an ASP.net application. The default time out for the application is 20 minutes. Currently, when it does time out, it reverts to an ugly error page. I would rather that it either logs the user off or simply sends him to the login or index page. Although I have found some very seemingly simple samples, I cannot get anything to work. I do not know if it makes a difference, but I am using an internal (<Iframe>) to rotate pages within a main page. I do not why that should make a difference since the session value is based on the session and not the page. Either way, I have tried posting the script on both the Main page that displays the frame and on the inserted frame page as well. It makes no difference. These are the two scripts that I have tried:
Style 1 is supposed to give the option to take the user to a new page if it is not responded to:
function warnuser()
{
if (confirm("There has been no activity for some time.\nClick 'OK' if you " +
"wish to continue your session,\nor click 'Cancel' to log out.\nFor your " +
"security if you are unable to respond to this message\nwithin 2 minutes you " +
"will be logged out automatically."))
{
//post the page to itself
document.location.href = "Main.aspx"
}
else
{
document.location.href = "Index.aspx"
}
}
Style 2 is simpler and simply posts a warning:
function SessionAlert()
{
alert("Your Session will time out in 19 minutes");
}
setTimeOut("SessionAlert", 1 * 60 * 1000);
I tried setting the second one for just a minute just to see if it would work. It doesn't. Following is the setting that is deployed on the web.config page in the ASP.net applcation (and it does time out in 20 minutes):
<sessionState mode="InProc" cookieless="false" timeout="20" />
Any assistance is greatly appreciated....Pat
|
|
|
|
|
Good thinking...
The way we all do in your scenario is we put a variable in session,and try to call the Variable. Say:
Session.Add("IsAuthenticated", true)
Now for every call to the server we validate this using
if(Session["IsAuthenticated"])
If Session cant be retrieved, we will see if the current request url is Login page. If not we pass it to Login using
login.aspx?RetUrl=yourcurrentpage.aspx
Thus if the user successfully logs in again, it will be redirected to original page.
And regarding Session Timeout exception, we just ignore it using try/catch.
This is our way of doing this, as we handle all of them in Server.
Well, if you like to handle this is client, It is better to keep a variable variable in Javascript which will hold the time when the last call is made. You might use this javascript in OnLoad event of Body.
var responsetime = new Date();
Now whenever any call to the server is made, you just use
var thisTime = new Date();
var difftime= new Date();
difftime.setTime(thisTime.getTime() - responsetime.getTime());
if(difftime.getMinutes() > 20){
alert('Session Expired');
location.href='login.aspx';
return false;
}
else
return true;
I hope this would seem to be a better approach to you.
Cheers.
|
|
|
|
|
Hello. I am uploading a video file to a remote server. After that i am converting it to flv file. This process may last upto 10 minutes depending on file size. If i show such label " Preview file is being prepared. Please wait." , there is no problem. But i dont want such an unneccesary delay, and to process it at background. So i wanted to place a link "Click to return to homepage." or auto redirect to homepage. But page didnt load until the process finished. How can i deal with this problem.
|
|
|
|
|
How you are uploading file on server ? Are you using AJAX any where for it ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Create an IFrame and upload the file from there. This will not affect the page to full postback. Show the message there.
And also if possible make an ajax call to the server, form the mail application, to detect how much data is been uploaded to the server till now and detect appropriate message.
|
|
|
|
|
I have a time series data in which a numerical indicator fluctuates over time. If I want to find out for which given day, this indicator has crossed above 30 in the past 3 days. Is it possible to write a SQL query that retrieve this information?
The logic to check for the crossing movement is:
IF indicator(day x) > 30 AND indicator(3 days ago from day x) <30 THEN
Return "YES WE HAVE AN UPWARD CROSSING MOVEMENT THROUGH 30 FOR PAST 3 DAYS!"
END IF
Can this be accomplished using a SQL CASE statement with a HAVING clause or something else?
I'd greatly appreciate any help! If possible please provide a sample code
By the way I really want to thank you guys for helping me recently...
|
|
|
|
|
This question will be best suited in the General database forum. Please make sure to post in correct forum from now on.
Just saw you have posted it there as well. Do not cross post. It is considered rude.
Assuming, your database fields are called indicator and date, try this:
select indicator from yourTable where indicator > 30 and datediff(date, getdate(),date) <= 3
if(@@rowcount > 0)
select 1
select 0
(not sure about order of getdate and date in datediff, you can check that through the query though)
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
modified on Tuesday, December 15, 2009 11:08 AM
|
|
|
|
|
Thanks a lot for your help D@nish, sorry about cross-posting.
|
|
|
|
|
Hi D@nish, the above query doesn't seem to take the condition of [indicator from 3 days ago which is less than 30] into account....
For instance, my table contains two columns:
Date-------------Indicator Value
12/16/2009-------45
12/15/2009-------33
12/14/2009-------29
12/13/2009-------23
12/12/2009-------27
12/11/2009-------35
12/10/2009-------29
12/9/2009--------24
...
...
I want to find out for which date, the indicator value had crossed from below 30 three days before to above 30. The answers are: "12/16/2009" and "12/11/2009". How should I contruct the query to do so?
Many thanks again.
|
|
|
|
|
James Shao wrote: The answers are: "12/16/2009" and "12/11/2009".
12/15 should also come. Right? 12/13 is less than 30 and 12/15 is more.
I hope this should work.
select tbl1.date as fromDate,tbl2.date as toDate, tbl1.indicator as fromValue, tbl2.indicator as toValue from yourtable tbl1, yourtable tbl2 where tbl1.indicator < 30 and tb12.indicator > 30 and datediff(date,tbl1.date,tbl2.date) = 2
(I have not tested the query so it may give some error)
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi guys,
I have a xml document as below and in Xslt I need to get the person name on the basis of email id as in below xml file , contributor node contain email id and associated name is included in Epic node can any body help me to get the name for each contributor through xpath?
<ONIXMessage>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Epic>
<Person>
<Name>Rohit</Name>
<Email>Rohit@gmail.com</Email>
</Person>
</Epic>
</ONIXMessage>
|
|
|
|
|
Rohit16db wrote: person name on the basis of email id as in below xml
Why Duplicate entry for Product->contributor->Email
XSLT is used to transform your xml into XHTML. You can easily move into some node decendant to the current one using XPath.
Tell me what exactly you require.
See
http://www.w3schools.com/xsl/[^]
for reference.
|
|
|
|
|
I have some controls (placeholders) that I'm trying hide/show, and a button that I want to enable/disable when the button is clicked, but none of that stuff is happening. What am I not doing?
I'm doing this (both panels are hidden by default, and the button is enabled by default:
protected void buttonRetrieveData_OnClick(object sender, EventArgs e)
{
this.WaitPanel.Visible = true;
this.OutputPanel.Visible = false;
this.buttonRetrieveData.Enabled = false;
try
{
blah blah blah...
}
catch (Exception ex)
{
if (ex != null) { }
}
finally
{
this.WaitPanel.Visible = false;
this.OutputPanel.Visible = true;
this.buttonRetrieveData.Enabled = true;
}
}
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Does the code run (is the event being fired?)
Is the button RetrieveData in an Ajax Update panel?
|
|
|
|
|
Eduard Keilholz wrote: Does the code run (is the event being fired?)
Yes, it does. I even tried putting the code (that doesn't work) into the Page_Load method thinking maybe it should go there instead, but that had no effect.
Eduard Keilholz wrote: Is the button RetrieveData in an Ajax Update panel?
No. The panels are PlaceHolder controls.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: this.WaitPanel.Visible = true;
this.OutputPanel.Visible = false;
this.buttonRetrieveData.Enabled = false;
John Simmons / outlaw programmer wrote: this.WaitPanel.Visible = false;
this.OutputPanel.Visible = true;
this.buttonRetrieveData.Enabled = true;
Aren't these contradictory? Whatever the case maybe, end result will be what is there in finally block. Isn't it?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
The intent is that when the button is clicked, the wait panel is displayed, the output panel is hidden, and the button that fired the event is disabled. When the process is finished, the wait panel is hidden, the output panel is displayed, and the button is re-enabled.
The finally block merely ensures that the controls are returned to the desired state, no matter what happens in the try block.
I don't see how the code I posted is contradictory.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I don't see how the code I posted is contradictory
I was thinking the other way. After the event the result will always be the same.
I don't think it will work (not among the even decent ASP.Net guys so may be wrong). Since the page will not be rendered during the phase where event is getting executed. I would rather employ a javascript function which make the panels visible/hidden before the server side event is fired and then in the event hide them.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Well, I did try moving the first block into the Page_Load method, but that didn't help at all...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|