|
i am attempting to write the cookies for a landing page.
i have used the following code to analyse the presence of cookies, but dont know how to write the cookie for the page loading.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Request.Cookies("Landing") Is Nothing Then
'if the name cookie does not exist ask user to enter name
Response.Redirect("landing.aspx")
Else
'if cookies already exist then show landing page
Response.Redirect("tMN_index.aspx")
End If
this seems to work in terms of directing to the landing page.. just need the cookie help....
i basically want the landing page to appear if the cookie isnt present, and then the landing page to generate the cookie if not present.
thank you
John Michael Kinsella
kinsellajohn@hotmail.com
|
|
|
|
|
As I understand, you want to know how to create a new cookie. Below is a simple example how to do that. Depends on your needs, set appropriate properties of System.Web.HttpCookie object.
Basically you simply add a new cookie object into Response.Cookies collection and that's all. Using Respose.Cookies class you can also remove or change any cookie your application creates.
Dim cookie As System.Web.HttpCookie
Dim cookieName As String
Dim cookieValue As String
cookie = New System.Web.HttpCookie(cookieName, cookieValue)
Response.Cookies.Add(cookie)
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
Hi all,
i have to validate for a textbox field in ASP.NET 2.0 using C#.
the requirement is that the textfield should accept only numbers.
i want the field such tat it should accept number..... any number of any length.....
please send me the code for the same......
the regular expression validator with the validation expression
ValidationExpression="[0-9]"
accepts only a single digit number.........
how do i make it accept any number!!!!!!!
Thanks,
Ramesh
|
|
|
|
|
Well, you should change the ValidationExpression to accept more than one character. Also, decide whether you will accept +/- sign before the number, decimal point etc. Than build proper regular expression and that's it.
I strongly recommend to read a little about "creating regular expression" on the MSDN.
And to make it works, and accept any number of digits modify ValidationExpression to "[0-9]*".
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
include * in your validation expression either at the begining or at the end.
|
|
|
|
|
hello ramesh,
try to use the following code in Javascript
function CkhInte(obj)
{
if (isNaN(obj.value))
{
alert('Please enter only digits');
return false;
}
}
hope it helps,
please rate this message if useful,
best regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Nice, but when user turn off javascript in browser it will allow him to enter incorrect input. It's necessary to do the same validation on server. ASP.NET validators do both for you.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
ValidationExpression="^\d+$"
the above expression is a regular expression validator to validate for numbers......
|
|
|
|
|
>hi i currently have an dataview which have some data. it is link to an dropdownlist which contain the type.
i have added the ALL option to the dropdownlist however i cant get it to work.
could anyone help me or giv option/suggestion i am really stuck...
(what i want is to have a dropdownlist which would filter the type of data i have in the gridview <==this i have achieve but i cant seem to add an ALL button to view all record)
also if possible i would like to have the dropdownlist retain the selected option retain after the datagrid have change
below is some part of my code which i think is vital currently i have achieve the filter of type however i cant seem to have the ALL option working..
<br />
protected void Page_Load(object sender, EventArgs e)<br />
<br />
{<br />
<br />
if (!IsPostBack)<br />
<br />
{<br />
<br />
SqlConnection conn = new SqlConnection((ConfigurationManager.ConnectionStrings["ASPNETDBConnectionString1"]).ToString());<br />
<br />
SqlCommand cmd = new SqlCommand("SELECT DISTINCT Type FROM Product", conn);<br />
<br />
try<br />
<br />
{<br />
<br />
conn.Open();<br />
<br />
SqlDataReader dr = cmd.ExecuteReader();<br />
<br />
ddltype.Items.Add("All");<br />
<br />
<br />
while (dr.Read())<br />
<br />
{<br />
<br />
ddltype.Items.Add(dr.GetValue(0).ToString());<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
catch<br />
<br />
{<br />
<br />
}<br />
<br />
conn.Close();<br />
<br />
}<br />
<br />
else<br />
<br />
{<br />
<br />
<br />
<br />
protected void ddltype_SelectedIndexChanged(object sender, EventArgs e)<br />
<br />
{<br />
<br />
<br />
string pType = ddltype.SelectedItem.Text.ToString();<br />
<br />
<br />
<br />
<br />
Response.Redirect("Product.aspx?Type=" + pType);<br />
<br />
<br />
}<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>"<br />
<br />
SelectCommand="SELECT [ID], [Name], [quantity], [Pic], [Type], [comment], [desc] FROM [Product]"><br />
<br />
</asp:SqlDataSource>
|
|
|
|
|
hi all,
Could anybody help me to Display MS Excel sheet in ASPX page in Excel format, in such a way that i could modify it and save it back.
Any suggation will be appritiated...
Many Thanks in advance..
Rajnish Kumar
rajnish
|
|
|
|
|
Hope the Article by Gnanandam Gopalan MS EXCEL[^] will help you.
Regards,
Satips.
|
|
|
|
|
First of all thanks alot for providing me your response. The link you sent would have been helped me , but i have to code in ASP.NET 1.1 and the exapmle in the link is for ASP.NET 2.0
I have already tried that link , but i was unable to use that code provided in that link in ASP.NET 1.1.
So if you could help me to do the same in ASP.NET 1.1 that will be very much appritiated..
Thanks and Regards
|
|
|
|
|
I don't think you can do it without help.
I am using Office Write from SoftArtisans.
http://officewriter.softartisans.com/
Their product allows you to easily and quickly read excel values on the server and update Cells in an excel spreadsheet. Also they have an activeX control that you can install on the clients. This activeX control has a "post" function (which can be called from a VBA Macro) that will allow you to post your file to an aspx page. I have been able to implement what you wish to do using the Office Writer. I don't know of any other way you can do this without having the user save the file to disk and then using an html file control to post the file to a server.
|
|
|
|
|
Hi ToddHileHoffer,
Great thanks for your response, i have visit the link that you sent me and it would have been help me if that software would have been available free for me. Could you pls sugges me any such support software for free , as i am a developer in a company and our client is not going to support me financialy for this issue..
So if could provide me such kind of software for free , or you couldl help me in any other manner by providing me any code solution, that will be greatly appritiated....
Thanks and Regards
Rajnish
|
|
|
|
|
Hi All,
I am Curently working on an C#,ASP.Net website, can any one help me how to upload the Images from the local system to the file system and the path of the same in the SQL Database. So that i can retrive the same image to display at the required place through the path which i have stored in SQL Database.
Please Please Please Please Please......... do any one help me out.
chandu
|
|
|
|
|
you can go for File Upload.
For more Details here[^]
Regards,
Satips.
|
|
|
|
|
If u r working in .net 2.0 use the fileupload control
by using that u can also specify where to save image and u can also store the path in the DB
|
|
|
|
|
Hello Everyone,
I dont want to let anybody to copy contents from my website(Persoanl)
Is it anyway to come out of this problem
|
|
|
|
|
|
Hello Dear,
Means you don't want to copy something from your web page ???
ok do the following code,
in your HTML view
in the body tag put statement as
this will disable your code seletion from your web page so it will the copying tooo...means no body can copy your code
hope it will helps...
regards,
koolprasad2003
Life is swing with you..Enjoy..
|
|
|
|
|
koolprasad2003 wrote: body ondragstart="return false();" önselectstart="return false()"
Sorry, but that won't stop anyone....
If soemthing is private put it on a password protected page. Otherwise, don't worry about it. What is so special about your code that you don't want anyone else to see it? It can help others to learn, to see how other people have done things.
Fred
|
|
|
|
|
It's still possible to get at the code, all you have to do is view the source. You're serving all this data over http, it's always going to be possible to get it if someone really wants to...
|
|
|
|
|
koolprasad2003 wrote: ...means no body can copy your code
Unless they disable javascript...
|
|
|
|
|
In NHibernate, how do I retrieve the current SQL Database connection string? At the moment I'm using...
ISession session = NHibernateHelper.GetCurrentSession();<br />
string connection = session.Connection.ConnectionString;
Thing is it's returning the connection string with the Password element missing so if my connection string in the web.config is...
<property name="connection.connection_string"><br />
Server=localhost; Initial Catalog=Database; Uid=sa; Pwd=password;<br />
</property>
It ends up returning...
Server=localhost; Initial Catalog=Database; Uid=sa;
...which isn't the correct connection string.
|
|
|
|
|
Hi,
A strange issue was encountered in our project!
A user could login to our project once he logs in his userid is stored in a session! Throughout the project we would display his name!
Now let us say one more user logged in the previous session is being overidden!
So it is showing the second user info in the first application
What could be the issue?
Gautham
|
|
|
|