|
Hi,
Here u go:
Solution1: You can pass imagePath as paramter from website, which may actually calling yr class lib project.
Solution2: You can define the image pathin web.config file n then from there u can read imagePath from class Lib proj.
Feel free to ask.
Regards
Anil Pal
|
|
|
|
|
Thaks for the reply
Unfortunately, none of these 2 approaches would work:
The first one requires the webservice to send the root as aparameter
The second one requieres that i know the final path, if i have a shared hosting, what would happen if the physical root is moved?? My app would stop working, thats why i cant use a fixed path, and should not send the root a s a parameter from the webservice calling the class, because of ntier separation, you know all that stuff about ntier development
The only solution is using the server.mappath("")
I could access this by adding a reference to system.net to the class library and then get the root with httpcontext.current.server.mappath("~/Images")
Alexei Rodriguez
|
|
|
|
|
i m gettin problem with session variables
con.Open()
Dim cid, cpass
Dim cmd As New OleDbCommand("select stdid,passwrd from table1 where stdid='" & TextBox1.Text & "',passwrd = '" & TextBox1.Text & "'", con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
cid = dr(0)
cpass = dr(1)
con.Close()
Session("cid") = cid
Exit While
End While
Response.Redirect("details.aspx?cid=" & cid, False)
Else
Label1.Text = "Invalid username/password."
End If
con.Close()
Catch ex As Exception
Label1.Text = ex.Message
if i put cid = 'any direct value' it navigates coreectly
bt when i assign it a variable,it doest
it details page the line goes like
Dim cmd As New OleDbCommand("select name1,branch,grade from table2 where stdid= " & Request.QueryString("cid"), con)
here request.querystring("cid" ) isnt able to read the value
plz help me out ...
|
|
|
|
|
parkash_C wrote: if i put cid = 'any direct value' it navigates coreectly
What does that mean? You put cid in multiple places? Do you mean in the session or on the Query String?
parkash_C wrote: Dim cmd As New OleDbCommand("select stdid,passwrd from table1 where stdid='" & TextBox1.Text & "',passwrd = '" & TextBox1.Text & "'", con)
That code is vulnerable to a SQL Injection attack. Please learn how to protect yourself. Read this for a start: SQL Injection Attacks and Some Tips on How to Prevent Them[^]
parkash_C wrote: here request.querystring("cid" ) isnt able to read the value
Again, what do you mean by that? Where is that code anyway? Is it in the details.aspx page?
parkash_C wrote: Dim cmd As New OleDbCommand("select name1,branch,grade from table2 where stdid= " & Request.QueryString("cid"), con)
Again, this is vulnerable to a SQL Injection Attack. You don't even validate your input! A mallicious user could put anything on the Query string and attack your application.
parkash_C wrote: plz help me out ...
I'm not entirely sure how. I don't understand what is wrong. Your title says "unable to retain value of session variable" but you never attempt to retrieve the session variable anywhere.
|
|
|
|
|
thanks fr injection attacks
even i m layman at dis...
i wnt to send stdid to another page"details aspx"
i m using response.redirect("details.aspx?cid=" & cid,false)
in details page i m retrieving it thru stdid = request.querysting("cid")
bt it gives error dat no value given to stdid
i hope u cn undertsnd.....
or give me brief idea hw cn i pass values thru pages....so dat session retain their values.
thanku
|
|
|
|
|
Please don't use SMS/TextSpeak. It makes it increadibly difficult to understand you.
fr = from
dis = this
wnt = want
bt = but
dat = that
cn = can
undertsnd = understand
hw = how
You are not saving much with these abbreviations. And the time spent by me decrypting them is just irritating. In general people will be much more receptive to your request for help if you write properly.
Now, when you log in you should not ever pass the log in token (which is what cid effectively is) via a query string. It is very easy to hack and pretend to be someone else.
You have a Session so store the value in there. You can then retrieve it from the Session in the next page.
Ditch the query string as a way of passing information (especially something as sensitive as this) between pages unless you expect the user to also use the mechanism for linking directly to some page.
|
|
|
|
|
ok...
i am storing session as if like Session("cid") = dr(0).
is this wrong way??
yes i m passin sensitive information.
but right now,i jus want it to work..
which is unfortunately not working..
Is there something like Viewstate, which can help me out..
|
|
|
|
|
parkash_C wrote: i am storing session as if like Session("cid") = dr(0).
So far so good. You are storing the value of the first column in the session.
On your other page you can then do
cid = Session("cid")
However, if no rows are returned from the database then cid won't have anything in it. Are you sure data is being returned from the database?
parkash_C wrote: Is there something like Viewstate, which can help me out..
Viewstate is for page postbacks. It has a very short lifespan. It sounds like you need a book or good article describing the state system in ASP.NET.
|
|
|
|
|
yes cid and session("cid") do get values from database ,i m sure on this.
could u just tell me d difference between cid and session("cid")
or please provide me a good link
thanks.....
|
|
|
|
|
parkash_C wrote: could u just tell me d difference between cid and session("cid")
cid is a variable in your program Dim cid, cpass . You have to make it again in the other page(s)
Session("cid") requests a value named "cid" from the Session state on your page.
parkash_C wrote: please provide me a good link
It is your code. I'm just echoing it back with corrections/suggestions.
|
|
|
|
|
parkash_C wrote: thanks fr injection attacks
Do you know what you talking about?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
I get that a lot. I suspect many people either don't speak English all that well, or don't read the article so they don't know what's actually in it and then thank me for the opposite of what I gave them.
|
|
|
|
|
yes i didnt read the article......
as per good Etiquettes i should thank the person
who is spending time on my query....
those who cannot help , they should mind their own buisness.....
@Colin
thanks for all your help
|
|
|
|
|
chill out man. There is nothing wrong you have done. Rest assured as long as you are willing to learn you will find many good people willing to help
parkash_C wrote: yes i didnt read the article......
I lost you there. What article are you talking about?
parkash_C wrote: as per good Etiquettes i should thank the person
who is spending time on my query....
Thank you, keep up the good manner
parkash_C wrote: those who cannot help , they should mind their own buisness.....
well, the best thing you can do is ignore them.
cheers
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Colin Angus Mackay wrote: I suspect many people either don't speak English all that well
Given English is not first language for many people, I don't think any one would hold that against them. What is annoying is the arrogance we see frequently. It is one thing to see broken English sentence, but completely different some one pushing his broken English to get away with unacceptable behaviour.
cheers
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yusuf.A wrote: Given English is not first language for many people, I don't think any one would hold that against them.
I do try to take that into account. The grammarian in me wants to correct missing definite articles, incorrect verb congugations and so on. My main weakness is SMS/TextSpeak. I just can't let that one go.
|
|
|
|
|
As an additional follow up:
Yusuf.A wrote: some one pushing his broken English to get away with unacceptable behaviour
I'm not so sure about that. In some languages what is perfectly innocent to them seems aggressive to us. Take differences between Spanish and English for example.
In English I would walk in to a pharmacy and say "I would like a big packet of Enalapril 5mg, please". I tried that in Spanish once and I got looked at as if I was mad. In Spanish you would say "Give me a big packet of Enalapril 5mg". There is even the imperative verb tense for it - A set of verb congugations specifically for issuing commands. Its closest equivalent in English would be the drill seargent barking commands at the troops. To me it is very impolite. But if I translate what I think is polite into Spanish it turns out that level is reserved for addressing the monarchy.
I've also made an attempt at learning Dutch. What is interesting there is the definiteness of some phrases that turn out to be optional. For example, asking directions. The response you might get back is "You must turn left at the second traffic lights". In reality there may be many routes to your destination and you don't have to turn at that particular junction. It is just the structure of the language.
|
|
|
|
|
Colin Angus Mackay wrote: I'm not so sure about that. In some languages what is perfectly innocent to them seems aggressive to us. Take differences between Spanish and English for example.
that is true. I have been to many parts of the world and have seen/interacted with different cultures and languages. I have heard people talking their native languages which sounds like two drill sergeants going after each other.
But, what strike me is, most of that is in verbal only. In most cases, if not all times, written is quite different. There is less harsh tone. In addition, the same people when talking to outsider, specially using different language would tend to tone it down.
just my 2 cents
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
try dr(0).getsqlstring();
and not try to use cid on multiple places in like this
and yes try the session value type casting to string maybe its a enough answer for your questions.
whats this means???:
<pre></pre>cid = dr(0)
cpass = dr(1)
con.Close()
Session("cid") = cid
|
|
|
|
|
is this correct syntax request.querystring("cid")????
is this enough to retrieve the value of session from other page!!!
or some other function is also required!!!
thanku
|
|
|
|
|
The code Request.QueryString("cid") is correct.
what i feel after reading ur posts is that u r not sure of what is a session, query string....
The statment Request.QueryString("cid") doesn't read value from session but it reads values from
Response.Redirect("details.aspx?cid=" &cid, False) that what u specified in the previous page.
If u r sure that cid has valuses frm previous page,then it is sure that u can retrieve that value using Request.QueryString("cid").
To read value frm session, use some variable var=Session("cid")
then the variable var wil contain the value wat u assigned in the previous page.
Moreover viewstate is used hold values pertaining to a single page.The value stored in viewstate can't be retrieved in next page.
Before using al these things, first go through basics like what is viestate,session,application variables, query string and so on. its helps u a lot..
Happy Coding...
|
|
|
|
|
Why didn't you explicitly declare this variable ?
Like: Dim ValueFromDB as Integer
Just my preference.
|
|
|
|
|
Why would I be programming in VB is the more pertinent question?!
|
|
|
|
|
because this is asp.net forum
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
i have a filed saved in sql sever db and its data type is int.
i fetch that field from db using this code and assign it to a variable called 'ValueFromDB'
<br />
Private Sub GetMyIntDataTypeField()<br />
<br />
Dim Get_ MyIntDataTypeField_StrSQL As String<br />
Dim Get_ MyIntDataTypeField_ObjCmd As SqlCommand<br />
<br />
Dim strConn As String = ConfigurationManager.ConnectionStrings("MyConnString").ToString()<br />
<br />
<br />
Dim MyCon As SqlConnection<br />
MyCon = New SqlConnection(strConn)<br />
<br />
Get_ MyIntDataTypeField_StrSQL = "Select MyIntField from MyTable"<br />
<br />
MyCon.Open()<br />
<br />
Get_ MyIntDataTypeField_ObjCmd = New SqlCommand(Get_ MyIntDataTypeField_StrSQL, MyCon)<br />
<br />
ValueFromDB = Get_ MyIntDataTypeField_StrSQL_ObjCmd.ExecuteScalar<br />
<br />
MyCon.Close()<br />
<br />
End Sub<br />
after obtaining this value i need to perform a simple subtraction, like
a = ValueFromDB - 17.
after subtraction i am getting, a = -17.
is this because "ValueFromDB" from DB in string format?
|
|
|
|