sql statement issue after url rewrite [closed] - iis-7

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am implementing URL REWRITE (IIS 7) in a client's website.
but I have a problem with the sql statement.
before I had this:
select * from 360 where titulo='"&request("titulo")&"'"
and it was ok.
an example of titulo was "Fiexpo Latinoamérica"
my old url was portfolio.asp?titulo=Fiexpo Latinoamérica
but now my new url is /portfolio/fiexpo-latinoamerica
I use ASP replace to remove the spaces and change them with an "-" among others simbols.
so now, my sql statement does not works... because there is no titulo in the database with that name.
how do I do?
I could easyle replace the - with an space, ok but I have "tildes" á é í ó ú
what do I do?????

How is that new URL generated? You should save the new URL (slug) for every item in the database so you can use that to generate the links and to search it when somebody is requesting the page.

Related

How to get location of website visitor without depending on JavaScript, since it will not work unless user allow it [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am developing a website using ASP.NET MVC, how can I get the current location (Country, city, district, lat-lng geolocation) of each visitor browses my website depending on IP address?
It's possible to get location by using IP address of visitor. Use web-service provided by ipinfodb.com :
string url = string.Format("https://api.ipinfodb.com/v3/ip-city/?key={0}&ip={1}&format=json", APIKey, ipAddress);
using (WebClient client = new WebClient())
{
string json = client.DownloadString(url);
Location location = new JavaScriptSerializer().Deserialize<Location>(json);
return location;
}
There are several services out there that can do this. Try, for example, this one: http://geoip.nekudo.com.
An example: http://geoip.nekudo.com/api/8.8.8.8
Look for "ip geolocation rest api".
There are many geo-localization service you can use. For example, I do this way.
Put this tag inside your main .html page:
<script type="text/javascript" src="https://l2.io/ip.js?var=userIp"></script>
Than you will find a global variable called userIp with the calling ip address.
Than you can use any geolocation tool to get all the information you need.

Understanding a simple http request [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
In some tutorial , i have this request structure :
POST /apps/thinghttp/send_request HTTP/1.1
Host: api.thingspeak.com
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: (number of characters in message)
api_key=(thinghttp_api_key)&number={phone_number_to_call}
I am trying to understand a few things about it :
where they say "(api_key)" and "{phone number..}" do they have to be inside the brackets or do you takes out the brackets ?
What is the content length ? (they just dont say that )
I would like to test it using https://www.hurl.it , and i cant understand where goes the last line ? i know the first line is in the post field, and the others are headers . but what about the last line- where it goes in this website ?
thanks .
http://community.thingspeak.com/tutorials/twilio/make-calls-with-twilio-using-the-thinghttp-app/
No you don't have to use brackets, they are posted along with what's inside of the brackets, the { } are just used to let you know that what's inside of them has to be edited by yourself.
The length in bytes of the message body. The message body in a POST request are all post parameters and values : api_key=(thinghttp_api_key)&number={phone_number_to_call} in this case.
Those are the post parameters you send along with the http request. api_key is the name of one of the post parameter and (thinghttp_api_key) is it's value. The ampersand & is used to add another POST parameter which is number in this case followed by the value {phone_number_to_call}.

How to import excel file into sql server? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I Need to import excel file into Sql server, i have tried by using Fileupload but the fileuploader acccepting all file types, is there any chance to restrict only selected types when we click on browse?
An alternative would be using AjaxFileUploader:
In Markup:
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError"
onuploadcomplete="AjaxFileUpload1_UploadComplete" AllowedFileTypes="xls,xlsx"
MaximumNumberOfFiles="1"/>
For more info : AjaxFileUpload
Extract file extension from filename and check.
string Extension = Path.GetExtension(fileUploadControlId.PostedFile.FileName);
use regex to validate file types
var regex = new Regex(#".*\.xlsx?$");

Redirect from www to non-www with using subdomain [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I need to redirect a URL from www to non-www when user enters URL with subdomain.
Example:
www.abc.xyz.com to abc.xyz.com
string url = Request["HTTP_REQUEST_URL"]; // not sure the exact Constant name of the header
Uri uri = new Uri(url);
if(uri.Host.StartsWith("www.") && uri.Host.Count(c => (c == '.'))>2)
{
Response.Redirect(url.Replace("www.", ""));
}
thought as was said before, i think it is redundant because browsers do this checks for you...
and you really should avoid being "too smart for your own good".

Password generator [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to generate some passwords (password generator), but I want to avoid characters that can be confused with each other (for example: Chair2bok). How can I do that?
Why don't you just use a character set that you DO want to use rather than those to avoid?
A standard set of 64 characters
!#%+23456789:=?#ABCDEFGHJKLMNPRS
TUVWXYZabcdefghijkmnopqrstuvwxyz
A larger set of 88 characters
!"#$%&'()*+,-./23456789:;<=>?#ABCDEFGHJKLMNO
PRSTUVWXYZ[\]^_abcdefghijkmnopqrstuvwxyz{|}~
Source: Characters to avoid in automatically generated passwords
I blogged about how to generate a strong password for SQL Server HERE.
It uses strings that you can remove the characters you don't want. I've already removed some like 1, I, 0, and O.
private static string CHARS_LCASE = "abcdefgijkmnopqrstwxyz";
private static string CHARS_UCASE = "ABCDEFGHJKLMNPQRSTWXYZ";
private static string CHARS_NUMERIC = "23456789";
private static string CHARS_SPECIAL = "*-+_%/";
private static string CHARS_ALL = CHARS_LCASE + CHARS_UCASE
+ CHARS_NUMERIC + CHARS_SPECIAL;
To generate passwords of various complexity, you can use the services. For example, GetPas (online password generator).

Resources