C# - Redirect A Custom Url With A Webservice?

Apr 27, 2010

I have a home server running at home and I want to grant family members access to certain private websites.

Reese with password 1234 should type in his url like this: http://www.my.my/reese1234 and get redirected to where I want him to be redirected to.

Can I use a webservice for this? If yes, how do I start? (I use ASP.NET and C#) Or is there a better option which will also improve performance? Of course I want to redirect with the least amount of performance so other processes will be on max bandwidth.

View 2 Replies


Similar Messages:

Custom Server Controls :: Add Webservice To Scriptmanager From A DLL Custom Control?

Jul 8, 2010

I'm creating a new control and I want to embed some webmethods but somehow I can't get it to work.

The webmethods are simple.

[Code]....

as you can see its only to encode and decode some text.

I try to add this webmethod with a custom contol like this

[Code]....

I don't get any error but when I test

[Code]....

Then I get the error

Fout: 'DavyQuyo.Text.Encoding' is empty of no object.

I really have to know how I can add the service from my custom control in a dll into my scriptmanager so I can call it with javascript.

View 1 Replies

Redirect To An URL When Invoke A Webservice Method In Application?

Jan 12, 2010

I have a web service method in .net as below:

[WebMethod(Description = "Adds two numbers", MessageName = "AddMessage")]
public string Add(string x)
{
string retVal = x;
string fileLoc = @"D:KumareshCreateFile.xml";
StreamWriter sw = new StreamWriter(fileLoc);
sw.WriteLine(retVal);
HttpResponse response = HttpContext.Current.Response;
response.Redirect(http://www.google.co.in", true);
sw.Close();
return retVal;
}

I deployed my webservice in IIS server. I have created another .net application, and called the webservice method from the new application. My problem is I am unable to redirect to the specified link[google.co.in]. I am getting the following error: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Web.HttpException: Response is not available in this context. at System.Web.UI.Page.get_Response() Sometimes I get the error as: "Object moved here". "here" is shown as a hyperliink, If I click here, i am redirected to the specified link.

View 1 Replies

WCF / ASMX :: Creating A Custom Namespce For A Webservice?

Sep 30, 2010

I am working on a web service right now and I am using the default namespace which is below one;

[WebService(Namespace = "http://tempuri.org/")]

How can I create a custom user interface?Like this page;http://ws.cdyne.com/WeatherWS/Weather.asmx

View 6 Replies

AJAX :: Custom Exception Handling In Webservice?

Jan 13, 2010

I am trying to write a webservice that's going to be used through ASP.Net Ajax. In this webservice I have to add exception handling so that in case of any error, I could log them to some central place and then throw.

In my other areas of code (like aspx pages), i have been using a basepage which Overrides System.Web.UI.Page class's OnError by adding a custom event handler. I want to do the same for my webservice as well.

Basically I do not want to decorate each webservice method with a Try Catch block. Instead if there is a clean way like to override the on error method, i want to go for that. Unfortunately the WebService class does not seem to have any functionality for this.

View 2 Replies

C# - Catching A Custom Exception Thrown By A WebMethod On WebService

Oct 1, 2010

I have a classical asp.net web service (asmx) and a web method in it. I need to throw a custom exception for some case in my web method, and I need to catch that specific custom exception where I call the web service method.

[Code]....

However, I cannot do that because when I add the web service reference on the client, I have service class, input and output classes, but I do not have custom exception class.

Also another problem is that, I have also problems with serializing Exception class (because of Exception.Data property implements IDictionary interface)

Is there a way to do this in my way, or am I in a completely wrong way, or is there something I miss about fundamentals of web services?

View 2 Replies

WCF / ASMX :: Webservice Custom Objects As Input Parameters?

Nov 9, 2010

I have a fundamental question to ask about web services. I'm currently writing a service that has custom classes (lots of them). Let's say a car is one example. For some reason I was thinking that the service should expose these objects. However once I created a site to consume the service, it looks as though the classes are not meant to be exposed. It looks like the best practice is to take in a string which may be xml or not and convert that string into the object in the service code.(especially for error handling or input validation)

For example, if I had the web method:

[WebMethod]
public car getCar(int carId)
{
//code here to return car object
}

This will take a car ID and return a car object. It also shows all the elements in the SOAP request and response objects (as well as the WSDL) which can be to external developers. However, when trying to consume the service from a website (or reference it in my code), I then need access to the Car class (which implies i need to expose it through the services as well?).

View 5 Replies

Custom 404 Redirect For A Site With URL Rewriting?

Sep 1, 2010

In my site, I have used IIS7's URL rewrite module to redirect URLs like http://mysite.com/File.aspx?Name=SomeName into http://mysite.com/SomeName.

It appears that IIS7 has created a corresponding rule check, so that any URL of the sort http://mysite.com/SomeURL is redirected to File.aspx. This is fine in most cases, when the URL is correctly rewritten.

The problem is that in some cases, the file no longer exists - http://mysite.com/SomeName2 will still get redirected to http://mysite.com/File.aspx?Name=SomeName2.

I want to show a custom 404 error page for this URL - how do I trigger the 404 error in global.asax (I have set application error logging and handling in global.asax)? The below code doesn't work.

Response.Status = "404 Not Found"
Response.AddHeader("Location", "http://mysite.com/Invalid-File.aspx?" & Request.QueryString.ToString)

View 3 Replies

Web Forms :: Redirect Custom Page While Error No 401.2 Occur

Nov 10, 2010

I have developed .net web application. When i change the page name(Which is not exist) in URL, it throws following error msg. I could not redirect the error page for respected error no(401.2..) Through IIS Admin and web config. Could anybody give appropriate solution. It is urgent. Access is denied. Description:
An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL. Error message 401.2.: You do not have permission to view this directory or page using the credentials you supplied. Version Information: Microsoft .NET Framework Version:1.1.4322.2470; ASP.NET Version:1.1.4322.2470

View 3 Replies

Web Forms :: Unable To Redirect To Custom Error Page

Jan 5, 2010

I have created a custom error page to redirect whenever any error occurs. I made the following changes to the web.config file

<customErrors mode="On">
<error statusCode="403" redirect="~/Error.aspx" />
<error statusCode="404" redirect="~/Error.aspx" />
</customErrors>

Suppose my url is in the following way: http://MyTestSite/Posts/Post1.aspx

If I remove the .aspx at the end manually then it is not displaying my customm error page instead it is dispalying default 404 error page : Page cannot be found.

Also, if I give http://MyTestSite/Posts the same 404 error message is displaying. Even the Application_Error event in global.aspx is unable to handle this error.

How can I redirect these type of cases to my custom error Page? Do I need to make any changes in IIS default errors or can I able to acheive only using web.config?

View 14 Replies

Web Forms :: Redirect In Custom Event Where Response Or Server Is Not Available?

Feb 24, 2011

I am using a custom event in third party library for my asp.net project. When the event happens, I need to redirect to another page. Problem is that since it is custom event, Server.Transfer or Response.Redirect can't be used (I tried but got "response is not available in this context"). So I think best way would be to trigger post back in the event and redirect in page_load event on appropriate conditions. Is this right approach or is there any better idea? And, how can I trigger postback?

View 2 Replies

Redirect - Custom Errors With Mode=remoteOnly And Global.asax Handling Exceptions?

Jul 19, 2010

I have custom errors set in the web config file as follows:

<customErrors mode="RemoteOnly" defaultRedirect="GenericError.aspx" />

Fine and dandy... I like that mode="RemoteOnly" facilitates development...

For unhandled exceptions, I have in global.asax:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("GenericError.aspx")
End Sub

However, unhandled exceptions are going to the generic error page instead of the informative yellow screen of death preferred by developers. I can comment out the redirect in global.asax, but then I need to remember to change it for the production environment. Is there a way I can check in Application_Error whether I am remote or not to determine whether to redirect?

View 2 Replies

State Management :: Using Application_Error For Redirection / Application_Error To Redirect The User To A Custom Error Page?

Oct 11, 2010

I am trying to use the Application_Error to redirect the user to a custom error page. I know I could use the web.config to do this, but let's assume for now that this is not a desirable path to take.

Initially, I tried to do a Response.Redirect to perform this, however, there seem to be occasions where the current http context does not define the response object. So, I attempted to perform a check to make sure that the response object is not null prior to attempting the redirection, and if it is not defined, perform a Server.Transfer instead.

What happens is that in most cases, the Redirect causes the browser to some generic "friendlyish" error page rather than the requested error page.

So then I tried using Server.Transfer exclusively, and this worked well for most cases, however, sometimes the transfer didn't seem to take in the browser. Changing it back to a redirect in these cases solved that problem, but reintroduced the issue where the errors previously being captured and transferred now were being redirected.

What I surmised from this is that in certain contexts where the Application_Error method is trapped, it is necessary to use Server.Transfer in redirection, whereas in others, it is necessary to use Response.Redirect. The question then became twofold: (a) When is one necessary and when is the other? and (b) What available information can I poll to tell me when a given condition exists.

After much searching, I cannot find a reasonable answer to this question. So I began to trap errors and examine the HttpContext object for some indicator. One thing that I was looking for is the reason why if even with a defined Response in the current context does a redirect fail. The only thing that stood out is that even though a Response object may exist, the Session data could be absent. I added the case to check whether the Session data was null and perform a Transfer in this case and it
seems to be handling it properly.

I emphasize "seems to be handling it properly" because no documentation I've been able to find confirms either the problem I am having or whether this is an appropriate strategy for solving it.

I guess the question is, am I on the right track here or is the null Session object just a red herring, indicative of nothing relevant. Here's the check I have set up for reference.

[Code]....

View 2 Replies

Web Forms :: Show "Custom Error Page" To Redirect To From A Non Existing Html Page

Jul 6, 2010

I want to show a "Custom error page" when i type a non-existing .aspx or .html page in my application. I had followed the same steps in the link [URL] for the HTML pages also but it is working for .aspx pages but not working for .html pages if I enter any non-existing pages. I had added the path of "aspnet_isapi.dll" for the .html extension in the IIS. I also ensured that the check box "Verify file exists" is unchecked while adding the ".html" entry in the "configuration" of the "Home directory" of the website in the IIS but still it is not working.

View 1 Replies

Which One Is Better Response.redirect Or Postbackurl(asp:button Feature) To Redirect Webpage

Aug 13, 2010

which one is better response.redirect or postbackurl(asp:button feture) to redirect web page?

View 3 Replies

Response.Redirect - Local Characters - Redirect To Obtain A Clean Url ?

Jul 18, 2010

I want to redirect to "~/City/Göteborg", but if I just write Response.Redirect("~/City/Göteborg"); I will end up with an ugly URL in the address-bar like this: http://www.mysite.com/City/G%c3%b6teborg..

So my question is how to redirect to obtain a clean url like http://www.mysite.com/City/Göteborg?

View 3 Replies

Web Forms :: Response.Redirect - Redirect To Error Page ... ?

Mar 6, 2011

I have a problem with Response.Redirect to specific error page.

so far i have something like :

protected void Page_Load(object sender, EventArgs e)
{

if ((Request.QueryString["UbytovaniePrispevokID"].ToString()) == "")[code]......

What i want to do is.. I have one main page with new posts Each subject of the new post is the link to Another page where is Specific post and coments and user can leave a coment.

What I want is when the Request.QueryString["UbytovaniePrispevokID"].ToString()) == "" or null I want to redirect to error page ...

View 3 Replies

Security :: Cannot Redirect To Login.aspx - How To Redirect To It

Apr 16, 2010

my application is running under asp.net 2.0 and in iis 5.0 (Windows XP) in my machine.config, i have the following setting

[code]...

whenever i go to my default.aspx page, it seems it doesn't redirect to login.aspx.

View 5 Replies

Redirect To Other Page From Pop Up Window With Response.redirect?

Feb 13, 2010

how can i redirect to other page from pop up window with response.redirect.

View 2 Replies

Error CS0029: Cannot Implicitly Convert Type Media.WebService.multiValuedAttribute To Media.WebService.multiValuedAttribute[]

Aug 5, 2010

In Visual Studio 2008 I have a Class Library project (called Media) to which I added a Web Reference (not a Service Reference) to a third-party web service (wsdl). In the Class Library project a proxy class is created for using the service along with several classes for the types used in that service.

I also have a second Class Library (called Sync) that references the first one. And then I have a Web Site project that references the second class library. All of this is .NET 3.5

So Web Site > Class Library (Sync) > Class Library with web service reference (Media)

I want to step into the generated code, so I fire up the web site in IIS 7.5 and trigger the call to a method in the second class library (Sync) that in turn should call the web service proxy. I was fully expecting to hit the breakpoint, but instead got an exception:

Unable to generate a temporary class(result=1). error CS0029: Cannotimplicitly convert type Media.WebService.multiValuedAttribute to Media.WebService.multiValuedAttribute[]

Why is ASP.NET trying to generate a temporary class? Don't I already have the generated class from the first Class Library (Media)?

View 1 Replies

Custom Server Controls :: Custom Tag Not Found For Control / Error: Unknown Server Tag 'custom:AjaxValidator'

Jan 3, 2011

Hope this is the correct forum for this question. I am using VWD 2010 an have a web project and get the following error upon execution:

Parser Error Message: Unknown server tag 'custom:AjaxValidator'.

My code is as follows in the .cs file:

[Code]....
[Code]....

View 1 Replies

Custom Server Controls :: Custom Composite Control With Custom Templated Child Controls?

Mar 22, 2011

I am trying to build a custom composite control, which allows me to add custom content to each child control. It's a similar concept to what you have with a GridView and TemplateColumn. The markup used to place the control on the page would end up being something like this:

[Code]....

I have the code below, which allows me to put that markup on the page without throwing any errors, and it renders all the correct HTML, except it doesn't render the contents of the ColumnTemplate. I have replaced the Render() code with a comment because it's quite long winded and doesn't add anything important here:

[Code]....

I have tried to follow examples on MSDN and other forums but I can't make this work. I think I'm missing the code to render the contents of the template, but I don't know how to hook that up.

View 1 Replies

Custom Server Controls :: How To Create Custom Property (DataSource) In Custom Controls

May 15, 2010

I know that how to create custom control and add custom property.

I want to create property like DataSource to my custom control.

View 1 Replies

How To Bind Form Collection Back To Custom Model Object That Uses 2 Custom Objects

Mar 23, 2010

What I'm trying to do is rather basic, but I might have my facts mixed up. I have a details page that has a custom class as it's Model. The custom class uses 2 custom objects with yet another custom object a property of one of the 2. The details page outputs a fair amount of information, but allows the user to post a comment. When the user clicks the post button, the page gets posted to a Details action that looks something like this:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Details(VideoDetailModel vidAndComment) { ....}
[Code]....

The only fields on the form that is posted are CommentText and VideoId. Here is what the VideoDetailModel looks like.

public class VideoDetailModel
{
public VideoDetailModel()
{
[Code]....
I suppose if I added more form fields for the properties I need, they would get posted, but I only need 1 form entry field for the CommentText. If I could get the same Model objects value that were sent to the page to post with the page, it looks like the solution is rather simple. I think using the RenderPartial in the middle of a form is problematic somehow to how the form gets written in html. I can't really put my finger on why things went bonkers, but if I do my RenderPartials before my form and then begin my form with the text entry field and the hidden VideoId, the default ModelBinder works just fine. I was beginning the form, writing the hidden VideoId, rendering several partial views, create my CommentText field, and then closed the form out. The CommentText field would get bound just fine. The hidden VideoId would not. Maybe I missed a rule somewhere about using RenderPartial.

For completeness, the partial view I was rendering took a Comment object and just wrote out it's CommentText data. Several of these objects would exist for a single Video object. All of this data was in a custom type and passed into the View (the main view) as it's Model. This partial view did not have a form and did not have any data entry fields.

View 2 Replies

To Create A Custom Control That Adds Other Controls Visible To The Page Hosting My Custom ?

Oct 22, 2010

I want to create a custom control where I define several specifically named DIV sections. The code-behind logic of the custom control will perform operations on these named DIV sections. The page where the custom control is hosted needs to be able to add named controls to the DIV sections and perform operations on these named controls added to the DIV sections.

Let me explain a little further. In the custom control, I want to have code behind logic that fires the following Page Event and uses a condition to make one or another specifically named DIV section visible or not:

< _
ToolboxData("<{0}:BaseDetails runat=""server""></{0}:BaseDetails>") _
> _
Public Class BaseDetails

[code]...

how can I create a custom control which is able to generate the named DIV sections "DetailsNameDiv1" and "DetailsNameDiv2" where my custom control can check a condition and make one or the other visible. Also, I need to be able to add controls to these named DIV sections when I host the custom control and the control that I add to the named DIV section needs to let me set values of these controls from the code behind logic of the page (or usercontrol) where the custom control is being hosted (in my example, I am adding TextBox controls that I want to set the Text property from a SQL Data Reader).

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved