|
Hello,
I have been using the Asp.Net 2.0 resource files to save information on various languages.
The problem is that I need to save some information on a database.
Consider a "News" database with the follwing fields: [news_id], [news_title], [news_text] and [news_date].
What I need is for a record to have various news_title and news_text for all languages.
The [news_id] and [news_date] will be common to all languages.
How should I build my database?
Should I have more then one table?
I am using Asp.Net 2.0 and Microsoft Access.
Thanks,
Miguel
|
|
|
|
|
Create a table for the title and text using a combined key consisting of the ID and a column identifying the language. A simple join can now retreive the title and text of a specific news id and language.
|
|
|
|
|
in my login page i have folliwing code:
if Session("UserRole") = "Admin" then
Response.redirect("http://kicakhist/MySite/Admin")
else
Response.redirect("http://kicakhist/MySite")
End if
but this doesnt work. even when i login using admin id and password, i get redirected to home page instead of admin page. why is it?
|
|
|
|
|
I don't work with VB.NET, but if I should apply C# approach, then Session("UserRole") is object, while "Admin" is string. If you compare object with string, then references are compared, and they are different of course. You should do following comparison:
if Session("UserRole").ToString() = "Admin" ...
Pilo
|
|
|
|
|
thank you for you reply. i tried what u suggested but still it doesnt work
|
|
|
|
|
now its working. i used Trim and also used ToString too.
if Trim(Session("UserRole")).ToString = "Admin" then
Response.redirect("http://kicakhist/MySite/Admin")
else
Response.redirect("http://kicakhist/MySite")
End if
thanks you for trying to help
|
|
|
|
|
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?
|
|
|
|