Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 20, 2007 02:03 PM by keyvan1
Sep 20, 2007 10:19 AM|LINK
i have this urlrewrite class which works fine
Dim app As HttpApplication
app = CType(sender, HttpApplication)
If app.Request.RawUrl.ToLower().Contains("/keyvan") Then
app.Context.RewritePath("profile.aspx", "", "uid=1")
but when i try to replace them with values from database it does not work.what can the problem be?
dr = cmd.ExecuteReader()
Sep 20, 2007 12:38 PM|LINK
It is not clear what the problem is from your post.
Is it giving you an error or just not redirecting ? If it giving you an error please provide the details about the error. If it is not doing the rewrite (not exectuing the line: app.Context.RewritePath("profile.aspx",
"", "uid=""" & dr("userid") &
""""), in this case there can be multiple posibilities.
1. You do not have the user that you are looking for ih the Users table.
2. The user name is not the same (has uppercase letters for example or spaces in the name).
3. Or maybe the users table is empty.
So you may want to rewrite the code to look somthing like this:
dim userName as string
' check if hte value dbnull
if (System.Convert.IsDBNull(dr("username"))) then
userName = ""
userName = dr("username").ToString()
userName = userName.ToLower().Trim()
hope this helps
Sep 20, 2007 01:50 PM|LINK
it is not redirecting i am using the right usernames
i even added your code whenever i use a username it redirects to index.aspx instead of profile.aspx?uid=
it works when i use simple code without dr
it's interesting if i use else like this the application somehow hangs?
isn't the problem with this line:????
"uid=""" & dr("userid") &
Sep 20, 2007 01:55 PM|LINK
sth important i noticed
if i write a username that does not exists i get error:
The resource cannot be found
but when i use right usernames i get redirected to index.aspx
Sep 20, 2007 02:03 PM|LINK
finally this worked
why didn't that line with quotations work but the next one with userid worked?