|
It means that you store to a session string like " Admin" instead of "Admin".
I'll give you an advice, store objects to session exactly as they should be there rather then correct stored value after retrieving. You will save yourself lots of trouble later (like the one you just solved )
|
|
|
|
|
Hi All,
I have created a custom provider for Membership for sql 2000 and am using the Login control on a page called Login.aspx. I have set the name of the cookie in web.config to ".C8AAUTH". I have the DisplayRememberMe set to True so that it appears on the login control. I authenticate using my username and password and it will then allow me access to restricted pages on the site. If close the browser and then re-open it again, User.Identity.IsAuthenticated will return True as expected.
The trouble is that if I close the browser, then come back half an hour later, User.Identity.IsAuthenticated will return False and I will be redirected to the login page. Logging in with the 'Remember Me' checkbox checked is supposed to write a persistent cookie, but in my case it doesn't appear to be doing this.
Can anyone shed any light on this please?
Many thanks,
Martin
|
|
|
|
|
not only does my login control keeps ignoring me, but everyone at Codeproject is too. Nobody loves me. Didn't want to use the stupid login control anyway.
I think I will just go and get a job as a waiter or something.
Boo Hoo.
|
|
|
|
|
Nobody is ignoring you; just we have problems to solve too,
Check and translate this solution
The Login Control name is Logeo
On LoggedIn
protected void Logeo_LoggedIn(object sender, EventArgs e)
{
/*Si el campo Recordarme en este equipo esta activo se guarda
el coopkie en el equipo del cliente*/
CheckBox chBox = (CheckBox)Logeo.FindControl("RememberMe");
if (chBox.Checked)
{
HttpCookie FmmbCookie = new HttpCookie("FmmbCookie");
Response.Cookies.Remove("FmmbCookie");
Response.Cookies.Add(FmmbCookie);
FmmbCookie.Values.Add("usuario", this.Logeo.UserName);
DateTime fechaExpiracion = DateTime.Now.AddDays(15);
//Al cookie se le asigno un periodo de vida de 15 días
Response.Cookies["FmmbCookie"].Expires = fechaExpiracion;
}
}
Everytime the user logged in, these lines write a persistent cookie over the client browsers (15 days live),just write the user name
On Page load you must to check if the visitor browser have the cookie.
In true case write the user name onto login control username.
protected void Page_Load(object sender, EventArgs e)
{
La_Fecha.Text = System.DateTime.Now.ToLongDateString();
if (!IsPostBack)//Se ejecuta cuando se carga por primera vez
{
//Verifica si el cliente tiene cookie activo
if (Request.Cookies["FmmbCookie"] != null)
{
HttpCookie cookie = Request.Cookies.Get("FmmbCookie");
string usuario = cookie.Values["usuario"].ToString();
if (usuario != "")
{
Logeo.UserName = usuario;
}
}
}
}
You can do the same with the password if you want.
keep Learning and you never will be out of date...
|
|
|
|
|
Hi Britney,
Thanks for taking the time to reply to my post. Apologies for taking so long to get back to you, but I didn't get my usual email notifying me that somebody had replied, and I just stumbled across your reply yesterday.
The login control is supposed to take care of this for automatically, but it appears that this isn't the case for a custom provider. There is probably an answer out there somewhere, but I don't have time to look any more. I have implemented a solution based on your suggestion, and it works just fine.
By the way, I know people weren't ignoring me really, that's just the strange British humour for you
Thanks again for your help,
Martin
|
|
|
|
|
hi,
i have just done with a simple project and i have an ftp account to upload the project.
i uploaded it already but it seems dosn't work. is there another way to publish my project.
please advice ?
|
|
|
|
|
soem more information is required.
any errors?
what version .net?
is it a signed assembly?
what have you uploaded?
does your server allow debug assemblies, and is it a debug build?
the list goes on
but this should get us started.
regards,
g00fy
|
|
|
|
|
thanks four your prompt response !
answers:
No
Yes
*.aspx, global, webconfig, assemply, Bin(*.dll)
yes
regards
|
|
|
|
|
sorry forgot to tell you
i am using .net 2003
|
|
|
|
|
Hi,
Can anyone give me the real world examples(In the Project how you handled and the need for the HttpHandlers and HttpModules)for Httphandlers and HttpModules.
Thanks in advance.
|
|
|
|
|
|
Hi
Guys i want my connection string to be encrypted in web.config , is there any way to do it, plzzzzz let me know ASAP, thankx in advance.
|
|
|
|
|
hi,
Use Cipher Data Class.
With Regards
Satips
|
|
|
|
|
You can write your own encryption logic, by using System.Security.Cryptography namespace. Go through the below links.
http://msdn.microsoft.com/msdnmag/issues/02/06/crypto/
http://www.codeproject.com/dotnet/encryption_decryption.asp
|
|
|
|
|
|
Hi
I need to setup a WIN XP machine as a Time server so that I can verify timming issues on a Web service from a Embedded device.
Any ideas?
Regards
|
|
|
|
|
|
Hello,
I am trying to create a simple email form for my schools web site. I have managed to create the simple script to send the info from the form as an email to myself. At the mo it just prints 'your msg has been sent success fully' on a white background, I would like the page to look like the rest of the website.
I have put the HTML that all the other pages use to display the main title and few other images but none of the images appear. I get the alt tags and it is laid out correctly.
Here is my effort: (try and be nice as I have no experience with scripting with ASP)
<% Option Explicit %><br />
<br />
<html><br />
<head><br />
<title>Message Sent</title><br />
</head><br />
<br />
<body><br />
<br />
<br />
<br />
<%<br />
Dim name, email, message, NewMailObj<br />
name=request.form("name")<br />
email=request.form("email")<br />
message=request.form("message")<br />
<br />
'create the mail object and send the details<br />
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")<br />
NewMailObj.From = email<br />
NewMailObj.To = ""<br />
NewMailObj.Subject = "New message sent.." <br />
NewMailObj.Body = "Name: " & name & _<br />
"<br>Email Address: " & email & _<br />
"<br>Comments: " & message<br />
<br />
<br />
NewMailObj.BodyFormat = 0 <br />
NewMailObj.MailFormat = 0 <br />
NewMailObj.Send<br />
<br />
Set NewMailObj = nothing<br />
Response.write "Thank you for your comments"<br />
%> <br />
<br />
<table width="700" border="0" cellpadding="0" cellspacing="0" background="images/main/back_green_blue.jpg" align="center"><br />
<!--DWLayoutTable--><br />
<tr><br />
<td height="150" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><br />
<!--DWLayoutTable--><br />
<tr><br />
<td width="700" height="150" valign="top"><img src="images/main/title_welcome.gif" alt="Welcome to Newbridge School" width="700" height="150" /></td><br />
</tr><br />
<br />
</table></td><br />
</tr><br />
<tr><br />
<td height="128" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><br />
<!--DWLayoutTable--><br />
<tr><br />
<td width="102" rowspan="3" valign="top"><img src="images/main/4square.gif" width="102" height="100" /></td><br />
<td width="83" height="13"></td><br />
<td width="498"></td><br />
<td width="17"></td><br />
</tr><br />
<tr><br />
<td height="88"></td><br />
<td valign="top"><div align="center" class="tilte"></div><br />
<div align="center"></div></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td height="27"></td><br />
<td> </td><br />
<td></td><br />
</tr><br />
</body><br />
</html> <br />
Cheers
Tom
|
|
|
|
|
What is the path to the "Success page"?
What is the path to the page from which you got the formatting?
What is the path to the image files?
|
|
|
|
|
The path for the success page is the dir where I store my scripts, which is correct (imo) as I am recieving emails to my account.
eggsovereasy wrote: What is the path to the page from which you got the formatting?
Not entirly sure what you mean here? The only formatting is done on the page in the HTML.
eggsovereasy wrote:
What is the path to the image files?
The path for the images is correct, I use the same path for all the other pages on my site.
Sorry if I have not answered your questions correct it's been about 5 years since I have attempted any kind of scripting (and that was in PHP)
I just want to get the success page looking like the rest of the website
Cheers for the help
Tom
|
|
|
|
|
Hi,
Lets say I have:
public class OrderItem
{
#region Private Variables
private Order m_Order; // Order object reference
#endregion
#region Properties
public Order OrderItemOrder
{
get { return m_Order; }
set { m_Order = value; }
}
#endregion
}
My ObjectDataSource looks like this:
<asp:ObjectDataSource id="odsOrderItems" TypeName="MyNamespace.BusinessLogicLayer.OrderItem"
SelectMethod="GetOrderItemsByOrderID" runat="server">
<SelectParameters>
<asp:QueryStringParameter Name="intOrderID" QueryStringField="OrderID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
I have the following in a GridView control:
<asp:BoundField DataField="" HeaderText="Order ID">
<HeaderStyle CssClass="GridViewHeader" />
<ItemStyle CssClass="GridViewCell" />
</asp:BoundField>
Lets say I want to display the ID value of the Order objects ID property, how will I do this in the DataField?? Normally in code I would do it like OrderItem.OrderItemOrder.ID, but it gives me errors if I do it like this: DataField="OrderItem.OrderItemOrder.ID".
Please can someone help.
Regards
ma se
|
|
|
|
|
DataField is a name of a column in your datasource, you databind to a gridview.
It depends on an sql query you run, for example if you are quering database with this query:
SELECT customer, orderId, ... FROM ...
then you can set DataField attribute to DataField="orderId"
Generaly, it is name of a DataColumn.
Pilo
|
|
|
|
|
Hi,
I understand what you are trying to say, but it's not making any sense in what I am trying to do.
I have the following SQL statement in a stroed procedure:
SELECT
OrderItemID_PK,
WineID_FK,
OrderItemUnitPrice,
OrderItemQty,
OrderID_FK
FROM
OrderItems
WHERE
OrderID_FK = @OrderID;
I only need the wine ID to populate the Wine object. In my DA class I did it like this:
// Do connections and stuff here
while (dr.Read())
{
OrderItem objOrderItem = new OrderItem();
// Populate other fields
Wine objWine = Wine.GetWineByWineID(dr.GetInt32(1)); // Related Wine object
objOrderItem.OrderItemWine = objWine; // Required
}
OrderItemWine is a property in the OrderItem class that sets the Wine object. I declared the Wine object in the OrderItem class like this:
private Wine m_Wine;
And the property that sets this Wine object in the OrderItem class is:
public Wine OrderItemWine
{
get { return m_Wine; }
set { m_Wine = value; }
}
Like this I can retrieve Wine information, now how do I get the wine name into my gridview, if I didn't define a Coloumn as such for the DataField property??
Please help. I hope it is more clearer.
Regards,
ma se
|
|
|
|
|
You can try and add a separate function into the datafield template, that calls the name of the wine, using the id you got from the select query, for that specific field.
EG: As the following into your
GetNameForID(wineID) //Id for the wine name you want to add here
or how about using parent/child relationship repeater or datagrid?
|
|
|
|
|
Hi, Could anybody help me to extract Metadata about Flash Video File .flv file. i.e. how to extract details about a particular flv file.
Thanks in Adavnce..
|
|
|
|