Welcome :Guest
Congratulations!!!

### google Translate Encoding Problems With C#

//Create a Google Translate String To Translate From Google. string Translate(string inputStr, string fromLanguage, string toLanguage) { string url = string.Format("http://translate.google.com/translate_a/t?client=t&text={0}&hl=en&sl={1}&tl={2}&multires=1&pc=0&sc=1", inputStr, fromLanguage, toLanguage); WebClient tmpClient = new WebClient(); tmpClient.Encoding = System.Text.Encoding.UTF8; string result = tmpClient.DownloadString(url); return result; } Now The Problem is If You Pass something like that Translate("Hello","en","ur"); Return String: JSON String But Couldn't Really Get The Write Method to Get ???? ???? Instead Of ? ?? ?? ? { ur: [[["? ?? ?? ?","Hello World",""]],,"en"] }   In Browsers The URL is Showing Correct Returned String. Urdu is unicode Language. The String Return in result is Whole Messed up with ???? ?? ???? something like that. I tried to Convert it in Different Encodings But Not Couldn't get Anythine usefull. How Can I Correct That I Wanted To Further Save It In XML File.

### Problems with encoding (UTF-8) when exporting Gridview to CSV

I have a gridview surrounded by buttons adding export functionality to Word, Excel, PDF, CSV/TXT. The code origins from:

http://www.aspsnippets.com/Articles/Export-DataSet-or-DataTable-to-Word-Excel-PDF-and-CSV-Formats.aspx

and was easily applied. Now, while the first 3 works like a charm, the CSV/TXT exports nicely enough, but the encoding goes *poof* so some - in my case Scandinavian - characters looks anything but Scandinavian. A screenshot on the aforementioned page indicates, that its not my use, but a general problem in this code (found below) I have been experimenting with response.charset and response.contentencoding with no luck. Does anyone here have a clue (or an alternative solution)

Protected Sub btnExportCSV_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.Clear()
Response.Buffer = True
Response.Charset = ""

Response.ContentType = "application/text"

GridView1.AllowPaging = False
GridView1.DataBind()

Dim sb As New StringBuilder()
For k As Integer = 0 T

### MVC3 Razor - Option to Not have Html encoding

Since all calls to methods (using Razor View Engine and syntax) that return strings have their result Html encoded, is there a way (or an option) to not have the return values html encoded?

For example if I have a simple method like so:

protected string RenderTable(IEnumerable<T> data)
{
/* Return some html */
}

and then in a view (using the Razor View engine) I have code like this:

@{RenderTable(Model);}

I'd like the returned string to be inserted into the view as-is and not Html encoded.

What are my options?

### Razor needs shorter syntax to prevent HTML encoding

It's great that Razor HTML encodes by default. However, many times I have HTML in a database and want to display it literally on a page. In WebForms 4, we can use <%= %> and <%: %> to choose between encoding options. Raven's syntax is currently @(new HtmlString(Model.Greeting)). This is far too verbose.

Please add a shorter syntax to Razor. Something like @=Model.Greeting or @@Model.Greeting, or something else.

Thanks

### Razor syntax hilighting problems in VS2010 SP1

When I add @Href function as in following code, hilighting switches off and intellisense is not working,

is there a way to overcome this? :

Correct hilighting:

<td style="width:2px;background-image:url('Images/left_side.bmp');background-repeat:repeat-y;"></td>

Wrong hilighting:

<td style="width:2px;background-image:url('@Href("~/Images/left_side.bmp")');background-repeat:repeat-y;"></td>

Wrong hilighting 2:

<td style="width:2px;background-image:url("@Href("~/Images/left_side.bmp")");background-repeat:repeat-y;"></td>

P.S. sorry did not find a way to upload screenshot...

### Top .NET Performance Problems and how to avoid them

Every time I work with one of our .NET customers to help them with managing their application performance I come across the same problems as seen with other clients before: lots of ADO.NET queries, many hidden exceptions in core or 3rd party .NET libraries, slow 3rd party components, inefficient custom code

### Visual Studio 2008 Memory problems

My memory in task manager reaches about 900,000K  and I don't know why it does this. Definately slows everything down, especially when I rebuild my tableAdapters, takes about 30 seconds sometimes to rebuild the project.

### Encoding en Decoding HTML

Hi,

I stored in a database a ntext "<b>Hello</b>";

But when  I read it from the database I see <b>Hello</b> instead of Hello.

In the html source I see this: &lt;b&gt;Hello&lt;/b&gt;

Any Idea?

Thanks

### Sending a File Using Email Helper in WebPages/Razor

Note: This is particularly with respect to Email Helper in WebPages/Razor. Please don't post links using System.Net.Mail object.

Under "Sending a File Using Email" section what exactly is the code trying to do.

1: The SendFile.cshtml does not have any option to select file.

2: ProcessFile.cshtml is running fine. I am getting the email but no attachement.

I tried changing fileAttachment input to type="file" but not file is being sent to my email. I just get the message send in body.

Question: How exactly this file attachment works using Email Helper in WebPages.

### How to configure IIS 7.0 for ASP.NET Web Pages Razor

I'm working on a blog framework using ASP.NET Web Pages with Razor Syntax and I'm having some trouble with URL rewrites. My server is a Windows Server 2008, which runs IIS 7.0. WebMatrix is already installed on the server and .cshtml pages runs without problems, as long as they are named "index.cshtml" I don't have to supply the extension.

What does not work, is when I have URLs that does not correspond to physical files, e.g. website/post/why where the only physical file I have is post.cshtml. With IIS Express, the post.cshtml file is execute but on IIS 7.0 I get a 404 error.

Should I install the URL Rewrite for IIS 7.0? What configuration changes is required?

### Problems with Forms Authentication in DD 4 site

Hello,  I am seeing a strange problem with Forms Authentication in my DD site.   A user logs into and can view/edit/delete data all day, but when they execute a Custom Filter against data (for example , a control DynamicData/Filters/CustomerLastNameSearch.ascx ) then the site auth fails, and redirects to the log in screen.

in web.config I have

<authentication mode="Forms">
</authentication>

Offhand, I am thinking two things : that DynamicData/Filters path requires some special handling for some reason, or the control extension ascx is causing auth to get confused.   Has anyone else experienced this or have any suggestions?  Thanks!

### ASP.NET XML Writer Encoding Problem

Hi everybody,

I'm working on an ASP.NET application which writes xml sitemap to xml file. while I'm generating the loc element, I found that the writer converts the "&" in dynamic URLs to "&amp;" which I think it's not acceptable by Google. is there any way to get out of this?

Part of my code is as follow:

                writer.WriteStartElement("url")
writer.WriteStartElement("loc")
writer.WriteString("/english/pages/pages.aspx?sid=" + drSections("SectionID").ToString + "&pageid=" + drPages("PageID").ToString + "")
writer.WriteEndElement()
writer.WriteStartElement("lastmod")
writer.WriteEndElement()
writer.WriteStartElement("priority")
writer.WriteString("0.5")
writer.WriteEndElement()
writer.WriteFullEndElement()

and my output comes like :

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>

### Problems posting to a package

Hey Y'all

I'm currently creating a program that accesses a mysql package to add data to a few tables.  I'm currently getting an error that says  "

## ORA-01403: no data foundORA-06512: at "JESSE.PKG_WORKPLAN", line 42ORA-06512: at "JESSE.PKG_WORKPLAN", line 177ORA-06512: at line 1

"

These lines are

42: INSERT INTO WP_PROJECTS_USERS (PROJECT_USERS_ID, FIELD_UNIT_ID, PROJECT_ID, USER_ID, START_DATE, DESCRIPTION)

Checking these variables in my asp.net page they are all receiving parameters.

Is there a  way to see what the database is actually receiving from the asp.net page?

Or is there another thing to be looking at?

Thanks!

### URL Routing and Existing HttpHandler problems

Hello everyone,

I have a problem:

I am currently using 2 features:

1. HttpHandler

Registering the path="res.aspx" verb="*"

2. URL Routing:

Registering with this pattern: "Company/Edit/{*companyId}","~/CompanyEdit.aspx"

In my CompanyEdit.aspx page, I used httphandler res.aspx to generate some images at client.

• res.aspx?img=1
• res.aspx?img=3

Now the problem is here, the page is load success with companyId = "12345", but when the images was loaded at client, it loaded the CompanyEdit.aspx again and show error with wrong id.

I have debug and find the problem that because when image's urls were generated to client with url=res.aspx?img=1, url=res.aspx?img=3, the asp.net will understand that they are Company/Edit/res.aspx?img=1, Company/Edit/res.aspx?img=3 when it maps with URL Routing pattern.

=> So the CompanyEdit.aspx was load again with wrong id (id now is "res.aspx").

So, do you have any ideas to solve this problem, or other design.

Thanks, and best regard

### ASP.NET 4 precompilation problems

Hello!

We used ASP.NET precompilation (first manually, then with VS2008 WDP) with .NET 3.5 almost (see below) successfully.

After we moved to 4.0, the precompilation no longer works properly. The precompilation process itself succeeds, and the website works, but it consumes about twice the CPU it does without any precompilation. We use non-updatable precompilation (so webpages get compiled completely).

Our internal profiling tells us that most of the threads spend their time within variations of the following stack:

...

System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(System.Web.VirtualPath virtualPath, bool ensureIsUpToDate) + 0xa2 bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x5b bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(System.Web.HttpContext context, System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0xcb bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResult(System

### Problems converting VS 2003 project to VS 2008

Hi!

I'm having problems converting a VS 2003 project to VS 2008 (tried 2005 as well, same problem). There are several problems;
a) I don't have VS 2003 installed.
b) The project is a web service, however I'm not sure what type of VS project it was created as.
c) The general knowledge about the project setup is..slim.

I get a error message using the conversion wizard, however, I'm not familiar with the tool and I cannot quite find any good information on Google for it, so I am left with a error message I do not understand.

Conversion Issues - myProject.csproj:
Unable to open the Web site 'C:\local\path\to\project\myProject.csproj'. The Web site 'C:\local\path\to\project\myProject.csproj' does not exist.

The web service is not intended to run on the dev machine, it is copied to a test or a prod server. However, I do not know how this was done previously. I'm thinking that in order to convert, it has to access the server on which it should run (which is set somehow in a config maybe). But that doesn't actually make any sence..

If anyone could shed light on this, I would really appreciate it.

Thank you.

I am trying to have the selected item in the menu be noticeable different than the other items.  I am able to change the border as in the samples, but nothing else. I would like the selected font color to change as well as the background image / color.  Here is a sample page and style sheet.  Any help is greatly appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >