Include Dynamic URL In My URL Without Using Query String?
Jan 18, 2010
ASP.NET 3.5, IIS7,In my Global.asax's Application_BeginRequest, I need to extract from the request's URL an entirely seperate URL that's been embedded in it without using query string.
The solution I came up with was to hex-encode the entire target URL as if it were a directory, as follows:
This fails for IIS7, whose ASP.NET implementation won't tolerate a URL path greater than 260 characters.My code controls how the request URL gets generated, and how it might embed the target URL in there, but it doesn't have any control over that target URL value (they're third-party URLs).How better could I embed this target URL in my request URL?
I'm using a pager and want to include a query string in some cases, like search to have a search parameter in the query string. Everything works fine with the pager. So, I tried the following line of code in my controller action for including search:
it contains can contains either of (1) strQuery = "TempTable.Group_No IN ()";
(2) strQuery = "TempTable.Group_No IN (1,2,3,4,....)";
My task is if it contains "TempTable.Group_No IN ()", (i.e) IN CLAUSE without data i have to replace the string (IN() with IN (NULL)) with "TempTable.Group_No IN (NULL)"
I recently encountered a problem when our project is derived to client. We used a single web page called default.aspx and passed parameters as querystring to load different webpages [URL]? p=232&q=90&id=3). But the client need a meaningful url [URL]. If we create each page for the client data we get millions of web pages and it is hard to create. Now we need to display dynamic data without passing querystring and they should look like individual webpages insted of a single webpage.
Well, i know the title isn't very specific, but i couldn't find a better succint description of what i'm looking for.i want to have a default.aspx so that when a user types:
http://www.mydomain.com/randomstring
i can use the randomstring to query a table on page load. More specific:
. I will be importing batches of users to my database through a csv file.
. in that process, a random string will be generated
. i will send that url to each user by email
. when the user clicks through that link, i want my aspx(c#) to interpret that string, query a table that gives me a second url, this one with querystring, and Redirects the user to that second address
I have an access MDB database of latitude and longitude coordinates (x,y). I also have a function in VB similar to:
Public Function Distance (x1,y1,x2,y2) as Double 'Some code here Distance = 'distance between x1,y1 and x2,y2 End Function
What I want to do is create a query that will show all locations contained in the table that are within 10 miles of user unetered coordinates (where LAT and LON are columns in the table and VarX and VarY are user proivided: SELECT *, Distance([LAT],[LON],VarX,VarY) as Dist FROM TableName WHERE Dist < 10
Obviously this doesn't work but I want to know how to accomplish this end result. Basically, I want to return a query of all locations within 10 miles of VarX and VarY. How do I incororate the Distance function into my query?
If it's not possible, what is the best workaround to accomplish this?
But neither of these seem to work. The content of classes.aspx is:
<script runat="server"> ' Square class Public Class square Public sqRows As Integer 'Numbers of rows this square has Public sqCols As Integer 'Number of columns this square has Public sqArray(,) As Integer 'The square array ' Initialise square array to match size of canvas Public Sub initSqArray(ByVal canvCols, ByVal canvRows) ReDim sqArray(canvCols, canvRows) sqRows = canvRows sqCols = canvCols End Sub End Class
I have the following LINQ query inside my models/article class, but i am facing problem in add the current user id in the where statment, as i need to only display the artciles created by the login user, i tried using ; embership.GetUser().ProviderUserKey & ToInt32(Membership.GetUser().ProviderUserKey) , but all failed, either becuase the error indicates that i can not inheret the Memebership class , or because i can not convert object to integer:-
return from userarticle in db.Articles
// where userarticle.User_ID = ToInt32(Membership.GetUser().ProviderUserKey)
orderby userarticle.create_date
select userarticle;
so how i can do so , in other words what should i write after the where "userarticle.User_ID =" ?????? . Hint i am using the default login mechanisim provided by the MVC.
I have an application that I am developing using ASP.Net with visual basic code. I have a table called "Customers" that contains 3 fields. The name of each field is "Name", "LocationA", and "LocationB". I want to code a select query that list two columns. The first column should contain the field "Name". I want the second column to contain the value in the field "LocationB" if "LocationB" is not null, else I want the second column to contain the value in the field "LocationA".
1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like
SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.
Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).
2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query
(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).
If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.
Trying to use a dropdownlist to query a database so that it will return all values except 1 (or more in future versions).
For example, assume you had a simple table name "MYFRIENDS" which has two fields named "GROUP" and "NAME" with the following records:
Group Name A John B Jane C Tony D Sue
What I want to do is create a DropDownList that has only 2 list items related to the "GROUP" field. The first list item should return records from the database related to Group A only. Then, the second list item should return all other records EXCLUDING those belonging to Group A.
The drop down list should look something like this (I've put a question mark where I don't know what to do):
[Code]....
After the selection is chosen in the above drop down list, it should query the database and return the desired result. I'm using an AccessDataSource with select parameters. Here's a sample of what that looks like:
[Code]....
Things I've tried that didn't work:
I tried using "Not A" as the the 2nd list item's value. I was thinking p1 would be replaced with the value "Not A" and the query would read "WHERE GROUP LIKE Not A". But, the query syntax "Like Not" is technically wrong. I tried changing the Where Clause to "WHERE GROUP p1" and then replaced the list item's value to "LIKE A" and the second to "NOT LIKE A". Again, I was thinking p1 would be replaced to read "WHERE GROUP LIKE A" and "WHERE GROUP NOT LIKE A". I also tried changing the "SelectCommand" itself so that after the dropdownlist changed, it would first change the selectcommand first and then run the query.
Why the first 2 items didn't work became somewhat obvious to me after thinking about it for a little while. However, I would think the 3rd one would/should work... as long as you have the sequence of events correct which up to this point I haven't been able to figure out.
My problem is that QualificationDescription has line breaks in it, if I put it in a TextBox it will display them but if I put it in a div it does not. Is there anyway to get the line breaks to show in a div?
However, the password (which I cannot change) contains an ampersand. ASP.NET throws: Configuration Error: An error occurred while parsing EntityName. Line XX, position YYY.
If I replace the ampersand in the password with &, I get a SqlException: Login failed for user 'myUser'. Usually this trick works, but I'm guessing that something is failing because this is technically a connection string inside a connection string.
What should I do here? Most of my classes include code like:
using (var context = new MyEntities()) { // do work }
Update: It turns out that the credentials I am using are a domain account, so what I really need is Integrated Security=True in the connection string rather than a password.
Encoding the ampersand as indicated in the accepted answer should work fine, though I haven't tested it.
I have a parent repeater that lists the sections of the website. this repeater binds to display a table that contain another repeater of the website pages .. or may display a table that contains another two repeaters of the projects categories and sub-categories.Until now everything is going fine.
The problem comes when I try to include a query of the section ID to the link of the project categories (DataView of the projects repeaters does not contain SectionID)my question is : is there any way to call the SectionID of the first repeater in my projects categories and sub-categories repeaters?Here is my code:
We are sending an HTML encoded string in the Query string. It was working fine on IIS 6 (windows 2003). We have recently moved the website to Windows 2008 (IIS 7.x). Since the move any Query String that contains "+" sign i.e., "%2b" gives error on the server "404 -File or directory not found."
I wanted to create a URL like http://localhost/menu.aspx/?id so that on typing this, it displays all the id's in the database. for eg:134
123
543
234
may be the id's which should be displayed after fetching from the database. However, it should be displayed as it it is without any control or without arranging in any gird etc. How can that be done?
I have very long select query which i need to filter based on some params, i'm trying to avoid having different stored procedures or if statements inside of single stored procedure by using partly dynamic TSQL.I will avoid long select just for example sake
select a from b where c=@c or d=@d
@c and @d are filter params, only one can filter at the same time but also both filters could be disabled. 0 for each of these means param is disables so i can create nvarchar with where statement in it...
How do i integrate in here dynamic query so 'where' can be added to normal query. I cannot add all the query as big nvarchar because there is too many things in it which will require changes ( ie. when's, subqueries, joins)
I have a table created on the fly. The table structure is dynamic.
This is the table structure generated by the end of year 2010
DealerCode, 201010, 201011, 201012
This is the table structure generated by the end of Jan 2011
DealerCode, 201011, 201012, 201101
What I need to do is selecting all data and then bind it into a gridview
To build a LINQ query, we need to drag the table into dbml file first. As we don't know how the table look like, can we add it in dynamically? Are there any other solutions?
I am writing a function in which i generate autocode in specific format i want to make this function generalize so that i send tablename and columnname parameter and function return the next code. I am using linq to sql with MVC e.g. i want to make table name and column name dyanamic