|
mavii wrote: put the value on the URL when you navigate to the second page ( the advantage of this is that your new page becomes bookmarkable
He meant pass the values through URL as query string. So your URL will look like yourpage.aspx?TextBox1Value=somevalue&TextBox2Value=somevalue . This can be taken in the page using Request.QueryString["TextBox1Value"] . And these type of URL's are bookmarkable, ie if you add this to bookmarks, it can be reloaded after some time. But if you use session and bookmarked the page, you can't reload it because session will be timed out.
|
|
|
|
|
Using query string is not safe regarding to security, whereas using session you can pass the value withouth user "see" it.
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
Riza Azmi wrote: Using query string is not safe regarding to security,
Choosing the method is always depends on the requirement. If security is not a main concern, query strings are the best, and in that case usage of sessions are not advised. Moreover as Christian told, the page will be book markable. But if security is the main concern, still you can use query string but after encrypting the value.
I always prefer query strings, since it won't keep anything in the server memory as session does.
|
|
|
|
|
session is hide the data. that is what I called "secure". no matter encrypted or no, user still cannot deal with the value directly.
session can store any datatype including datasource.
thanks for sharing
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
Tamper the Querystring Parameters. It's safe. Session Objects should be used only when you need a value through out the session accross the pages. When it's just a input parameter to generate a report which is not going to be the same every time you fetch the data then Query string is the best way here.
Regards - J O H N -
|
|
|
|
|
Hello friends,
Here is another error which I am getting in asp.net
My task is to change the color of an image in grayscale or sepia and after that save that image to the server.
I have completed the half part of that task but in the remaining half i am getting an error.
The error is "System.ArgumentException: Invalid parameter used."
Now let me explain what i am doing is Using bitmap for changing image color and after that saving that bitmap on server at that point i am getting this error...
i am writing some of that code here:::
Public Function ConvertToGrayscale(ByVal source As Bitmap) As Bitmap
Dim bm As New Bitmap(source.Width, source.Height)
Dim x
Dim y
For y = 0 To bm.Height - 1
For x = 0 To bm.Width - 1
Dim c As Color = source.GetPixel(x, y)
Dim luma As Integer = CInt(c.R * 0.3 + c.G * 0.59 + c.B * 0.11)
bm.SetPixel(x, y, Color.FromArgb(luma, luma, luma))
Next
Next
Return bm
End Function
Public Function ConvertToSepia(ByVal source As Bitmap) As Bitmap
Dim bm As New Bitmap(source.Width, source.Height)
Dim R, G, B As Integer
Dim x
Dim y
For y = 0 To bm.Height - 1
For x = 0 To bm.Width - 1
Dim c As Color = source.GetPixel(x, y)
R = CInt(c.R * 0.393 + c.G * 0.769 + c.B * 0.189)
If R > 255 Then R = 255
G = CInt(c.R * 0.349 + c.G * 0.686 + c.B * 0.168)
If G > 255 Then G = 255
B = CInt(c.R * 0.272 + c.G * 0.534 + c.B * 0.131)
If B > 255 Then B = 255
bm.SetPixel(x, y, Color.FromArgb(R, G, B))
Next
Next
Return bm
End Function
Private Function uploadFile(ByVal oFile As System.Web.UI.HtmlControls.HtmlInputFile, ByVal cbochoose As DropDownList, ByVal txtITitle As TextBox, ByVal ControlNo As Long, ByVal CoverType As String)
Dim obm As Bitmap, obm1 As Bitmap, obm2 As Bitmap
obm = New Bitmap(oFile.Value)
obm1 = ConvertToGrayscale(obm)
obm1.Save(strFilePath & strFName_B)
obm2 = ConvertToSepia(obm)
obm2.Save(strFilePath & strFName_S)
obm.Dispose() : obm1.Dispose() : obm2.Dispose()
oFile.PostedFile.SaveAs(strFilePath & strFName & strFExt)
End Function
I don't know exactly where i am getting error... at which step...
Now tell me what will be the reason of getting that error.......
I am waiting for your reply....
please try it first and after that give the answer.
Thanks in advance................
|
|
|
|
|
Read my image processing articles, this is the worst way you could create greyscale/sepia images.
Which line blows up ? Did you go through the debugger to check, for example, if the paths you're generating are valid ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi christian,
I have solved out this problem thanks for your reply i got the answer from their.
really appreciating your way of reply.
i understand what my mistake is.
thanks for your reply.
|
|
|
|
|
hi,
my web application is able open excel template on my system(server),
when i run this application on client machine(another system)
every thing works fine but excel template is not opening
can anybody knows wht i have to,
thanks
Afreen
|
|
|
|
|
Is EXCEL installed on the client machine?
Regards - J O H N -
|
|
|
|
|
|
iam having a textbox in that i write some text and press enter then a function should execute .
|
|
|
|
|
You can use AJAX to execute a server side function
|
|
|
|
|
hi navaneeth how ru ... this is id by writting the code in server button click .and i called the button click in javascript like this
var obj
obj=document.getElementById("btngetdata");
obj.click();
still its not getting is any other with out using ajax
|
|
|
|
|
I have created one library which will help to call button event when enter key is pressed. Check this[^] and download the library
|
|
|
|
|
DefaultButton.SetDefaultButton ( control , btButton )
where i should write this one
|
|
|
|
|
You can write in page load.
|
|
|
|
|
txtBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+Button1.UniqueID+"').click();return false;}} else {return true}; ");
this is working sir thanks u sir
|
|
|
|
|
jagadeeshkumar2106 wrote: how can i call code behind function through java script function (help plz)
maybe. you can use ajax.
function fireFunc() {<br />
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;<br />
if (keyCode == 13) {<br />
<br />
var req = false;<br />
<br />
if (window.XMLHttpRequest) {<br />
req = new XMLHttpRequest();<br />
}<br />
else if (window.ActiveXObject) {<br />
req = new ActiveXObject("Microsoft.XMLHTTP");<br />
}<br />
req.open('POST', "http://urdomain.com/urpage/aspx", true);<br />
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');<br />
req.onreadystatechange = function() {<br />
if (req.readyState == 4) {<br />
}<br />
}<br />
req.send("querystring");<br />
<br />
}<br />
}<br />
<br />
<br />
<input type="text" value="Check Answer" onkeypress="fireFunc()" >
|
|
|
|
|
You will have to put your function/procedure in a page and this page needs to be called as specified by Michael Sync. You can send any value to it using the querystring.
Nav
|
|
|
|
|
i want the code to run a procudere when enter key is pressed in asp.net apllication .the key event should happen when i press the enter key in textbox.
|
|
|
|
|
Use Javascript function and call it on the server side.
TextBox1.Attributes.Add("onkeypress","CheckKeyCode();")
Validate the key as:
function CheckKeyCode()
{
if(event.keyCode == 13)
{
return true;
}
else
{
return false;
}
}
God is always with you.
|
|
|
|
|
jagadeeshkumar2106 wrote: i want the code to run a procudere
this procedure is written in Javascript? if yes, chk the example below..
Example.
function fireFunc() {<br />
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;<br />
if (keyCode == 13) {<br />
yourprocedure();<br />
}<br />
}<br />
<br />
<br />
<input type="text" value="Check Answer" onkeypress="fireFunc()" >
|
|
|
|
|
sorry. i didn't see Saranya Devi's post.
|
|
|
|
|
sir the procedure is in code behind and it should call in javascript
|
|
|
|