Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Saturday, March 31, 2012

Trim URL

Hi,
I am involved in designing a website in which on a certain page(that contains a form) if some message is to be shown to the user the URL looks like
http://myserver/somepage.aspx?message=.....
Now if on that page the user requests re-submits the form I want the URL to be trimmed as simply http://myserver/somepage.aspx

Also is there some way that I can send such error messages through some means(like POST) such that there is no change in the url.If yes plz elaborate on it

Cheers,
-Aayush

Why don't you pass the parameter into a session, so instead of passing ?message=.....

do

Session["message"] = "...";

and in the next page you do:

string message = Session["message"].ToString();

Session.Remove("message");


you can use server variables and retrieve the required info

Wednesday, March 28, 2012

Trivia Game Help!

Hi I need a trivia game for a website. I'm using C# and have tried searching the internet for a sample application but could not find one. So can someone pls help me on how to create one? I would really appreciate the help.

Tahnks

That's pretty vague.....

Is this some homework project you are getting others to try to do, or are you just trying to get a full blown app for free?


How well did you search? There must be a million trivia games out there. You at least should have found the Absolute Beginner's tutorial videos on this web site (click "Learn" on the menu above). There's a four part seris on creating a quiz engine.

Jeff


Hi is there one for asp.net 1.1 coz i'm still new to C# and asp.net. Pls if you can send me a sample application to get me started or if you can give me a link to a website that you know where i can perhaps download the app.

Thanx

Monday, March 26, 2012

trouble dynamically loading content to my website

I am trying to dynamically load other pages into one main page on my website kinda of like a "wapper page." I was told to use PlaceHolders to do so but can't get the code to work. The link I am following is http://www.ftponline.com/vsm/2002_10/online/hottips/gusmano/ . I did everything according to the article but I get an error.
My code looks like this:
default.aspx:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
string page = Request.QueryString.Get("page");
PlaceHolder1.Controls.Clear();
if (page == null)
PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));
else
{
PlaceHolder1.Controls.Add(LoadControl(page + ".ascx"));
}
}
</script>
<html>
<head></head>
<body>
.....
</body>
</html
and the default.ascx is just a regular html page including a flash document:

<html>
<head>
<title>Main</title>
</head>
<body>
<center>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="640" height="480" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="http://pics.10026.com/?src=main.swf" quality="high" bgcolor="#000000" width="640" height="480"
swLiveConnect="true" NAME="main.swf" name="main" align="middle"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</center>
</body>
</html
The error I get is :
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'PlaceHolder1' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 6: {
Line 7: string p = Request.QueryString.Get("page");
Line 8: PlaceHolder1.Controls.Clear();
Line 9: if (page == null)
Line 10: PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));

Source File: F:\WWW\default.aspx Line: 8

What am I doing wrong? Also where do I add code into my default.aspx page to tell it where to load the other pages. As far as I can see, it just knows the load the a page but I can't figure out how it knows where to load it. I really appreciate all your help. Thanks a lot.What this is saying is that your placeholder1 does not exsist. Check your code to ensure you are using the corredt spelling for placeholder 1.
check out this maybe this can help

http://dotnet247.com/247reference/msgs/51/256296.aspx
I copied and pasted my code from my file. I really have no idea why it is saying that it doesnt exist. Do I have to import a library??

Trouble getting started

I have created a new website on my server. I save myfirst page and try to open it and this is the error I get..... can anyone help me...

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The currentcustom error settings for this application prevent the details of theapplication error from being viewed remotely (for security reasons). Itcould, however, be viewed by browsers running on the local servermachine.

Details: To enable the details of this specific error message to beviewable on remote machines, please create a <customErrors> tagwithin a "web.config" configuration file located in the root directoryof the current web application. This <customErrors> tag shouldthen have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Notes: The current error page you are seeing can be replaced by acustom error page by modifying the "defaultRedirect" attribute of theapplication's <customErrors> configuration tag to point to acustom error page URL.

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

In your web.config file you have the following:

<customErrors mode="Off"/>

Change it to:

<customErrors mode="On"/>

So you will get the description of the real error.


Try it and that didn't work.. but I am not sure where to put that... so here is my xml file...

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="false" strict="false" explicit="true" />
<pages>
<namespaces>
<clear />
<add namespace="System" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" />
<add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="System.Web" />
<add namespace="System.Web.Caching" />
<add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" />
<add namespace="System.Web.Profile" />
<add namespace="System.Web.UI" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Web.UI.WebControls.WebParts" />
<add namespace="System.Web.UI.HtmlControls" />
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->

</system.web>
</configuration>


You need to do this:

<customErrorsmode="Off" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>


Nope.. didn't work... same error. I am opening my .xmlfile in Visual studio and then just saving it... I don't have to rebootthe webserver or anything right. Also I am not on thewwwroot. My file is in wwwroot/asp

Rich


Hmmmm. Try to replace this:

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>

with this:
<customErrors mode="Off"/>


if mode=

"On" specifies that custom errors are enabled. If no defaultRedirect is specified, users see a generic error.

"Off" specifies that custom errors are disabled. This allows display of detailed errors.

"RemoteOnly" specifies that custom errors are shown only to remote clients, and ASP.NET errors are shown to the local host. This is the default.


Still not working. God this is frustrating. Is there some settings that I have to be changing on my server orsomething??

Since I am new to ASP.. do I need the web.config file?

What is the error that I am actually getting or you can't tell because the error won't show on the page??

Rich


I think you are working directly on your web site virtual path; where you have a tool "Visual Web Developper Express Edition" that you can download for free and work on it on a temporary folder; then after testing your site, you can upload it to whatever IIS server you wish. Correct me if this is not the situation that you are in.

After all, please post the page html, and code behind that you are trying to run.


Hello,

Please do bare with me. I am brand now to ASP, I am switiching from cold fusion.

Soi am working on my computer and I created a new website on mywebserver. I working out of a folder called ASP under thewwwroot.


Not sure what you mean by "web site virtual path". I openmy visual studio, and instead of creating a webstie on my webserver Icreated a new website on mycomputer. I can't seem tofind the directory where it created the website. I found theplace where I copy the files to the remote web site. So i copiedthe website through visual studio over to my webserver. I try toview the page but it give me the same error. Here is my code forthe web page I am trying to run. It is a general template and Ijust put some letters inside the form.

<%@. Page Language="VB" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
sdsdaf
</div>
</form>
</body>
</html


First in Visual Studio, there is a window called "Solution Explorer"; if you select the project (left click once on the root of the project), you will find in the properties window a property "Opened URL" which will show you what is the path of your project.

Second before uploading (copying) your files to the remote website, you can run your web application directly from Visual Studio by pressing F5 (to run with debugging enabled) or Ctrl+F5 (to run without debugging enable). So, try to run your application from Visual Studio and see what error you are getting.


As said above check for the virtual folder setting if problem still is not solved get the event log files and post the error message here.


Ok.. so I just did the F5 thing... and the page loaded fine.

So it started a local service host on my computer and ran the page with no errors.


SO now do I copy over to my webserver??

So now I can develop my whole site on my computer and then move it to my webserver??

Rich


Of course you can develop your website on your computer and then move it to your web server.

But you have already mentioned that you have created a website on your web server; are you sure you have configured it correctly? have you installed the asp.net extensions for this website?


I tried creating a new website right on my webserver. And I hit the F5 button, but ran fine with no errors. It lookedlike it ran off my local host on my terminal computer and not thewebserver. SO i went to the page through IE and ran it off thewebserver and then it kicked me the same error. So obivisouly anddon't have the .net set up right on my server. Anychance you know what is going wrong on my webserver...

Rich

Saturday, March 24, 2012

Trouble with ASP.net validation

I built this website. It works and the validation works. I want in addition to the star to appear the label on the left for the text to turn red.

www.nodebt.com

The old website which i did too in classic asp http://www.nodebt.com/form.asp - it works as i want it.I ran both pages. The old style changed the label to read and did not show the '*'.

In Microsoft's validators, you have limited formatting options. You can hide the '*' by setting the Display property to "none". You cannot automatically change the color of another field's label. You'd have to write code on the server side that detected if each validator IsValid property is false and change the style of the associated label. If you use the client-side validation (a benefit of ASP.NET), there isn't a clean hack to help you.

I wrote my productProfessional Validation And More for ASP.NET to solve these formatting limitations. I encourage you to review my site to learn what I've done and all the other limitations of Microsoft's validators so you can determine the best course of action. In my product, you can indicate the label and have it change to a different style when the error is shown. It works fully within client-side validation.