|
I HELPED, I HELPED.....finally!
|
|
|
|
|
Yes exactly, does any of you guys know how to assign it as a Session variable
and then how to retrieve it back?
Thanks a lot!
|
|
|
|
|
Session["Giveitaname"] = value
//if the value you are storing is string i suggest do this
if(!string.IsNullorEmpty(Session["Giveitaname"].toString())
{
newvalue = Session["Giveitaname"].tostring();
}
//otherwise just check if null then cast it accordingly
|
|
|
|
|
Thank's a lot for your post! Works!
|
|
|
|
|
Hello,
When I try to add a web reference in Visual studio 2005.
Below operation do not happen:
A WSE-enabled proxy class is added to the project
I just have two files in the Webreference folder:
wsdl and disco map.
Regards
Pavas
Regards,
Pavas
|
|
|
|
|
Is there a special trick to clearing a javascript cache in IE7?
I have tried deleting all files through IE, deleting the temporary asp.net files, rebooting the machine - it still runs the old code.
If I call the page from another machine running IE6, it runs the new code.
Googling shows up some pretty weird stuff that has not helped...
TIA!!!
|
|
|
|
|
Have you tried holding CTRL+SHIFT on your keyboard while pressing the refresh button at the top?
I hope this helps.
|
|
|
|
|
Ok try selecting tools --> internet options --> settings (under browsing history) --> select the option every time you visit --> set disk size to 8 also you can then click on the advanced tab under security check the box Empty temporary internet files folder every time browser is closed
A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty I am a Optimist
|
|
|
|
|
Thanks for both suggestions - these both work fine for inline javascript, but still does not refresh the external .js file.
|
|
|
|
|
Hello all,
i wrote this code for my catalogue pictures for my shop site,i want become thumbnail my pictures:
Eval("picure_url", "thumb_{0}")
but my pictures become loss when i add Thumb_ to my code
what do i do now?
thank you,
Hoda
modified on Wednesday, April 2, 2008 3:59 PM
|
|
|
|
|
|
Thank you very much for your response.
|
|
|
|
|
Hello,
I am trying to attach a signature with the proxy and trying to do some operation like below:
wse.RequestSoapContext.Security.Tokens.Add (new X509SecurityToken(cert));
X509SecurityToken crtTkn = new X509SecurityToken(cert);
http://www.eggheadcafe.com/articles/20021231.asp
I am not able to see a "RequestSoapContext" under my proxy of webservice...? Could some one please suggest. What I might be missing. I have installed WSE 2.0
Regards,
Pavas
|
|
|
|
|
Hi
Can somebody please help me out. I created a Site that works but the code is directed to an Access Database.
I swopped to SQL Server 2005 and need to alter my code to connect and Select the Username and Password from
SQL Server 2005.
What changes do i need to make?
See Code Below please.
Imports System.Collections.Generic
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dlgLogin.Focus()
'Sets connectionstring and checks if user is logged in...................................
DBFunctions.setConnectionString(AccessDataSource1.ConnectionString)
If Not IsPostBack Then
'Page counter code...................................................................
If Application("PageCounter") Is Nothing Then
Application("PageCounter") = 1
Else
Application("PageCounter") += 1
End If
lblCounter.Text = Application("PageCounter")
'Connection........................................................................
If Not Session("Email") Is Nothing Then
LoggedIn()
Else
lblName.Visible = False
End If
End If
End Sub
Public Sub LoggedIn()
lblName.Visible = True
linkEdit.Enabled = True
lbtnLogout.Enabled = True
linkEdit.Visible = True
lbtnLogout.Visible = True
'Rater check for Username...............................................................
Try
Dim checkList As List(Of List(Of String)) = DBFunctions.queryRows("SELECT Username FROM Rater WHERE Email = '" + Session("Email") + "'")
lblName.Text = "Hello, " + checkList(0)(0)
lblName.ForeColor = Drawing.Color.DarkGreen
Catch ex As Exception
End Try
'Company check for Company Name................................................................
Try
Dim checkList2 As List(Of List(Of String)) = DBFunctions.queryRows("SELECT Name FROM Company WHERE Email = '" + Session("Email") + "'")
lblName.Text = "Hello, " + checkList2(0)(0)
lblName.ForeColor = Drawing.Color.Black
Catch ex As Exception
End Try
dlgLogin.Visible = False
linkRater.Visible = False
linkComp.Visible = False
linkPassword.Visible = False
End Sub
'boolean, returns true if login successful, false if not
Private Function authenticate(ByVal uname As String, ByVal password As String) As Boolean
'Rater check for email and password................................................................................
Try
Dim checkList As List(Of List(Of String)) = DBFunctions.queryRows("SELECT COUNT(Email) FROM Rater WHERE Email = '" + uname + "' and Password = '" + password + "'")
If checkList(0)(0) = "1" Then
Return True
End If
Catch ex As Exception
End Try
'Company check for email and password.............................................................................
Try
Dim checkList2 As List(Of List(Of String)) = DBFunctions.queryRows("SELECT COUNT(Email) FROM Company WHERE Email = '" + uname + "' and Password = '" + password + "'")
If checkList2(0)(0) = "1" Then
Return True
End If
Catch ex As Exception
End Try
Return False
End Function
Protected Sub dlgLogin_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles dlgLogin.Authenticate
e.Authenticated = authenticate(dlgLogin.UserName, dlgLogin.Password)
End Sub
Protected Sub lbtnLogout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtnLogout.Click
dlgLogin.LoginButtonText = "Log In"
lblName.Visible = False
lbtnLogout.Enabled = False
lblName.Text = "Hello, "
Session.Clear()
Session.Abandon()
Session.RemoveAll()
dlgLogin.Enabled = True
Response.Redirect("Default.aspx")
End Sub
Protected Sub dlgLogin_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles dlgLogin.LoggedIn
Session("Email") = dlgLogin.UserName
LoggedIn()
End Sub
'For setting Label from other forms
Public Property Header() As String
Get
Return lblName.Text
End Get
Set(ByVal value As String)
lblName.Text = value
End Set
End Property
Protected Sub linkEdit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles linkEdit.Click
If lblName.ForeColor = Drawing.Color.Black Then
Response.Redirect("CompanyRegister.aspx")
Else
Response.Redirect("RaterRegister.aspx")
End If
End Sub
End Class
|
|
|
|
|
Looks like you've encapsulated your database logic well enough that you should only need to update your queryRows method and your setConnectionString method. There isn't any difference in your code that you've posted. Lookup SqlConnection and SqlCommand for a good start on how to rewrite your methods.
Etienne wrote: DBFunctions.queryRows("SELECT COUNT(Email) FROM Company WHERE Email = '" + uname + "' and Password = '" + password + "'")
As an aside, this is really bad practice for any application regardless of wither it's Access or SQL Server.
Instead you should do the following:
<br />
"SELECT COUNT(Email) FROM Company WHERE Email = @email and Password = @password"<br />
If you are using SQL Server pass this to the SqlCommand object. If you're using Access use OleDbCommand. Then regardless of the command object set the value of @email and @password using Parameters collection of the command object you create. You open yourself up to SQL Injection attacks otherwise.
Also, when you're updating data you're open to cross-site scripting attacks (XSS) unless you sanitize the data you get from the user using either Server.UrlEncode or Server.HtmlEncode. like this:
<br />
Dim email As String = Server.HtmlEncode(Request.Form("email"))<br />
<br />
' now you can pass your variable "email" to your SQL command<br />
<br />
<br />
I didn't see any examples of how you're updating data in your code above, but seeing your queries makes me think you aren't sanitizing your inputs either.
Sorry if the code samples don't compile, I haven't used VB in at least 6 years and I've never really used VB.NET.
|
|
|
|
|
Hi, I kind figure out the problem why the FormsAuthentication cookie can't be set, because just after the authentication it brings me back to the same page with the message that my session has been expired.
Lets see my webconfig.
<system.web>
<authentication mode="Forms">
<forms path="BackOffice" loginurl="BackOffice/Default.aspx?state=Timeout" protection="All" timeout="1">
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
The state=Timeout is caught to show an alert saying that the session has been timed out
The code that i use just after a successful authentication:
'FormsAuthentication.SetAuthCookie(tbxEmail.Text.Trim, False)
FormsAuthentication.RedirectFromLoginPage(tbxEmail.Text.Trim, True)
Response.Redirect("Home.aspx")
After a successfull authentication I don't get directed to the Home.aspx page.
When i set the following in the webconfig:
<forms path="BackOffice" loginUrl="BackOffice/Default.aspx?state=Timeout" protection="All" timeout="1" cookieless="UseUri">
but than my string changes to something like:
http://localhost:4190/TEST/(F(DkeaiAh5OWpUmiVajjisadVvodQMLp1lpg4yu8pQK_PlxqApl5udnh7iAx1Yi8KhNbLIx6pQkytYVuhnwCj7GmfkbmpD-2IxXSxyilQM5HDrQ9-byppwLdbd_uBxEeSNdo5UNcPd9nxQxW0ZU3o3Sw2))/BackOffice/Home.aspx
What I am doing wrong? How i can use normal cookies zo i don't need to have the UseUri flag?
Thanks
|
|
|
|
|
ESTAN wrote: FormsAuthentication.RedirectFromLoginPage(tbxEmail.Text.Trim, True)
Response.Redirect("Home.aspx")
Your call to Response.Redirect doesn't get called because you're calling RedirectFromLoginPage before it. Do something like this:
<br />
<forms .... other attributes .... defaultUrl="~/BackOffice/Home.aspx" cookieless="UseCookies" /><br />
And your code can just be:
<br />
FormsAuthentication.RedirectFromLoginPage(....)<br />
You don't need to do anything special to use cookies. Calling RedirectFromLoginPage will set the user's cookie and the FormsAuthentication module will take care of managing the session ticket in the cookie.
And if you're session is still timing out, set your timeout to something more than 1 minute. 30 minutes is the default. 1 minute will never work in a real application, it would only be valid for testing what happens when the session times out. Here's the documentation for the <forms> element: http://msdn2.microsoft.com/en-us/library/1d3t3c61.aspx[^]
|
|
|
|
|
Well i tried it, I've set the timeout to 55 minutes, added the defaultUrl and the cookieless attribute.
I changed all my code to that single line FormsAuthentication.RedirectFromLoginPage(email, false)
Well i can't seem to get it work, it calls immediately the login page again.
http://localhost:4190/TEST/BackOffice/Default.aspx?state=Timeout&ReturnUrl=%2fTEST%2fBackOffice%2fHome.aspx
I don't get it. Any idea why this is happening?
|
|
|
|
|
Have you checked FormsAuthentication.CookiesSupported to verify if the client supports cookies?
If that doesn't help, post your code and config file again to show us what it looks like now with your changes.
|
|
|
|
|
Sorry, i was a bit out.
I did a check on FormsAuthentication.CookiesSupported and it says true (i logged it to a file)
So i am a bit clueless here why this is happening.
webconfig:
<br />
<system.web><br />
<sessionState timeout="60"/><br />
</system.web><br />
<br />
<system.web><br />
<authentication mode="Forms"><br />
<forms path="BackOffice" loginUrl="BackOffice/Default.aspx?state=Timeout" defaultUrl="BackOffice/Home.aspx" timeout="55" cookieless="UseCookies"><br />
</forms><br />
</authentication><br />
<authorization><br />
<!--<allow users="*"/>--><br />
<deny users="?"/><br />
</authorization><br />
</system.web><br />
The validation code:
Protected Sub btnValidate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnValidate.Click<br />
Dim dt As DataTable = db.GetData("SELECT Active FROM tblUsers WHERE Email = '" & tbxEmail.Text.Trim & "' and Password = '" & Replace(tbxPassword.Text, "'", "''") & "'")<br />
<br />
If (dt.Rows.Count = 0) Then<br />
' This means that the combination of the email address and the password could not be found in the database<br />
lblLoginMessage.Text = CType(ViewState("vsAlerts"), Hashtable)("Alert1").ToString<br />
Else<br />
If (CType(dt.Rows(0)(0), Int32) = 0) Then<br />
' This means that the user is not allowed to log in, the Active bit is set to 0<br />
lblLoginMessage.Text = CType(ViewState("vsAlerts"), Hashtable)("Alert2").ToString<br />
Else<br />
Session.Add("User", tbxEmail.Text.Trim)<br />
Session.Add("Date", DateTime.Now.ToString)<br />
Session.Add("Active", 1)<br />
<br />
Common.LogInfo("FormsAuthentication.CookiesSupported: " & FormsAuthentication.CookiesSupported(), 3, Parameters.LOG_FILE, "clssDbAccess.SetData")<br />
<br />
FormsAuthentication.RedirectFromLoginPage(tbxEmail.Text.Trim, False)<br />
End If<br />
End If<br />
End Sub
|
|
|
|
|
can anyone please give me an idea how to insert new records from a gridview control by using a button having text ADD in the header
sudha
|
|
|
|
|
sudhadotnet wrote: can anyone please give me an idea how to
Ever heard of MSDN?[^]
led mike
|
|
|
|
|
Hi, Sorry if this is asked already,
I am doing...
button_Click(...)<br />
{<br />
literal1.Text="<iframe src="../Forms/NEW_Forms/MyForm.aspx" width="100%" height="100%"></iframe>";<br />
}
This works fine on my local machine wen I run is from VS
I cannot get the page when I put this on a local server, Should I change the URL in any way?
I tried using
literal1.Text="<iframe src="~/Forms/NEW_Forms/MyForm.aspx" width="100%" height="100%</iframe">";</iframe>
But no result,
This one is real easy for you guys, Please help.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
check that the path for the folder is exactly the same as above, also try specifiying the full path and see if that works
|
|
|
|
|
Hi,
try the below code, hey but i m not sure its working..but let see
button_Click(...)
{
literal1.Text="<iframe src="./Forms/NEW_Forms/MyForm.aspx" width="100%" height="100%"></iframe>";
}
If above code is not working then try using Server.MapPath("MyForm.aspx")
I hope it will help u..
Regards,
Rana Krishnraj
|
|
|
|